Cisco ASR 9000 Serie Configuration Manuals page 104

Aggregation services router system
Table of Contents

Advertisement

Programming Policies with Tcl: Sample Scripts Example
#------------------------------------------------------------------
# EEM policy that will periodically execute a cli command and email the
# results to a user.
#
# July 2005, Cisco EEM team
#
# Copyright (c) 2005 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
### The following EEM environment variables are used:
###
### _cron_entry (mandatory)
###
###
###
###
### Example: _cron_entry
###
### _log_file (mandatory without _email_....)
###
###
###
###
### Example: _log_file
###
### _email_server (mandatory without _log_file)
###
###
### Example: _email_server
###
### _email_from (mandatory without _log_file)
###
### Example: _email_from
###
### _email_to (mandatory without _log_file)
###
### Example: _email_to
###
### _email_cc (optional)
###
### Example: _email_cc
###
### _show_cmd (mandatory)
###
### Example: _show_cmd
###
# check if all required environment variables exist
# If any required environment variable does not exist, print out an error msg and quit
if {![info exists _log_file]} {
if {![info exists _email_server]} {
set result \
"Policy cannot be run: variable _log_file or _email_server has not been set"
error $result $errorInfo
}
if {![info exists _email_from]} {
set result \
"Policy cannot be run: variable _log_file or _email_from has not been set"
error $result $errorInfo
}
if {![info exists _email_to]} {
set result \
"Policy cannot be run: variable _log_file ore _email_to has not been set"
error $result $errorInfo
}
if {![info exists _email_cc]} {
#_email_cc is an option, must set to empty string if not set.
set _email_cc ""
}
}
if {![info exists _show_cmd]} {
set result \
error $result $errorInfo
Cisco ASR 9000 Series Aggregation Services Router System Monitoring Configuration Guide, Release 4.2.x
88
"Policy cannot be run: variable _show_cmd has not been set"
Configuring and Managing Embedded Event Manager Policies
- A CRON specification that determines
when the policy will run. See the
IOS XR Embedded Event Manager
documentation for more information
on how to specify a cron entry.
0-59/1 0-23/1 * * 0-7
- A filename to append the output to.
If this variable is defined, the
output is appended to the specified
file with a timestamp added.
disk0:/my_file.log
- A Simple Mail Transfer Protocol (SMTP)
mail server used to send e-mail.
mailserver.example.com
- The address from which e-mail is sent.
devtest@example.com
- The address to which e-mail is sent.
engineering@example.com
- The address to which the e-mail must
be copied.
manager@example.com
- The CLI command to be executed when
the policy is run.
show version

Advertisement

Table of Contents
loading

Table of Contents