Table 173: E-mail-Specific Environmental Variables Used by the Sample Policies
Environment Variable
_email_server
_email_to
_email_from
_email_cc
The following example of a must define section shows how to program a check for e-mail-specific environment variables.
Example of Must Defines
Example:
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]} {
set result \
"Policy cannot be run: variable _email_cc has not been set"
error $result $errorInfo
}
Step 7
Program the body of the script.
In this section of the script, you can define any of the following:
• The event_reqinfoevent information Tcl command extension that is used to query the EEM for information about
the detected event.
• The action Tcl command extensions, such as action_syslog, that are used to specify EEM specific actions.
• The system information Tcl command extensions, such as sys_reqinfo_routername, that are used to obtain general
system information.
Description
A Simple Mail Transfer Protocol
(SMTP) mail server used to send
e-mail.
The address to which e-mail is sent.
The address from which e-mail is sent.
The address to which the e-mail must
be copied.
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
How to Write Embedded Event Manager Policies Using Tcl
Example
The e-mail server name can be in any
one of the following template formats:
• username:password@host
• username@host
• host
engineering@example.com
devtest@example.com
manager@example.com
1793