![Cisco ASR 9000 Serie Скачать руководство пользователя страница 84](http://html.mh-extra.com/html/cisco/asr-9000-serie/asr-9000-serie_configuration-manuals_66679084.webp)
•
The action Tcl command extensions, such as
action_syslog
, that are used to specify actions specific to
EEM. For a list of the available EEM action Tcl command extensions, see the
Action Tcl Command Extensions, on page 150
.
•
The system information Tcl command extensions, such as
sys_reqinfo_routername
, that are used to
obtain general system information. For a list of the available EEM system information Tcl command
extensions, see the
Embedded Event Manager System Information Tcl Command Extensions, on page
167
.
•
Use of the SMTP library (to send e-mail notifications) or the CLI library (to run CLI commands) from
a policy. For a list of the available SMTP library Tcl command extensions, see the
Command Extensions, on page 178
. For a list of the available CLI library Tcl command extensions, see
the
CLI Library Command Extensions, on page 181
.
•
The
context_save
and
con text_retrieve
Tcl command extensions that are used to save Tcl variables
for use by other policies.
The following example Tcl code shows the code to query an event and to log a message as part of the body
section:
# Query the event info and log a message.
array set arr_einfo [event_reqinfo]
if {$_cerrno != 0} {
set result [format "component=%s; subsys err=%s; posix err=%s;\n%s" \
$_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]
error $result
}
global timer_type timer_time_sec
set timer_type $arr_einfo(timer_type)
set timer_time_sec $arr_einfo(timer_time_sec)
# Log a message.
set msg [format "timer event: timer type %s, time expired %s" \
$timer_type [clock format $timer_time_sec]]
action_syslog priority info msg $msg
if {$_cerrno != 0} {
set result [format "component=%s; subsys err=%s; posix err=%s;\n%s" \
$_cerr_sub_num $_cerr_sub_err $_cerr_posix_err $_cerr_str]
error $result
}
EEM Entry Status
The entry status part of an EEM policy is used to determine if a prior policy has been run for the same event,
and to determine the exit status of the prior policy. If the _entry_status variable is defined, a prior policy has
already run for this event. The value of the _entry_status variable determines the return code of the prior
policy.
Entry status designations may use one of three possible values:
•
0 (previous policy was successful)
•
Not=0 (previous policy failed),
•
Undefined (no previous policy was executed).
EEM Exit Status
When a policy finishes running its code, an exit value is set. The exit value is used by the EEM to determine
whether or not to apply the default action for this event, if any. A value of zero means that the default action
Cisco ASR 9000 Series Aggregation Services Router System Monitoring Configuration Guide, Release 4.2.x
68
Configuring and Managing Embedded Event Manager Policies
How to Write Embedded Event Manager Policies Using Tcl