![Cisco ASR 9000 Serie Скачать руководство пользователя страница 106](http://html.mh-extra.com/html/cisco/asr-9000-serie/asr-9000-serie_configuration-manuals_66679106.webp)
}
if [catch {smtp_send_email $result} result] {
error $result $errorInfo
}
}
sl_intf_down.tcl Sample Policy
The following sample policy runs when a configurable syslog message is logged. The policy executes a
configurable CLI command and e-mails the results.
::cisco::eem::event_register_syslog occurs 1 pattern $_syslog_pattern maxrun 90
#------------------------------------------------------------------
# EEM policy to monitor for a specified syslog message.
# Designed to be used for syslog interface-down messages.
# When event is triggered, the given config commands will be run.
#
# July 2005, Cisco EEM team
#
# Copyright (c) 2005 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
### The following EEM environment variables are used:
###
### _syslog_pattern (mandatory)
- A regular expression pattern match string
###
that is used to compare syslog messages
###
to determine when policy runs
### Example: _syslog_pattern
.*UPDOWN.*FastEthernet0/0.*
###
### _email_server (mandatory)
- A Simple Mail Transfer Protocol (SMTP)
###
mail server used to send e-mail.
### Example: _email_server
mailserver.example.com
###
### _email_from (mandatory)
- The address from which e-mail is sent.
### Example: _email_from
###
### _email_to (mandatory)
- The address to which e-mail is sent.
### Example: _email_to
###
### _email_cc (optional)
- The address to which the e-mail must
###
be copied.
### Example: _email_cc
###
### _config_cmd1 (optional)
- The first configuration command that
###
is executed.
### Example: _config_cmd1
interface Ethernet1/0
###
### _config_cmd2 (optional)
- The second configuration command that
###
is executed.
### Example: _config_cmd2
no shutdown
###
# check if all the env variables we need exist
# If any of them doesn't exist, print out an error msg and quit
if {![info exists _email_server]} {
set result \
"Policy cannot be run: variable _email_server has not been set"
error $result $errorInfo
}
if {![info exists _email_from]} {
set result \
"Policy cannot be run: variable _email_from has not been set"
error $result $errorInfo
}
if {![info exists _email_to]} {
set result \
"Policy cannot be run: variable _email_to has not been set"
error $result $errorInfo
}
if {![info exists _email_cc]} {
Cisco ASR 9000 Series Aggregation Services Router System Monitoring Configuration Guide, Release 4.2.x
90
Configuring and Managing Embedded Event Manager Policies
Programming Policies with Tcl: Sample Scripts Example