Embedded Event Manager Scripts And The Scripting Interface (Tcl) - Cisco ASR 9000 Serie Configuration Manuals

Aggregation services router system
Table of Contents

Advertisement

Embedded Event Manager Scripts and the Scripting Interface (Tcl)

Embedded Event Manager Scripts and the Scripting Interface (Tcl)
EEM scripts are used to implement policies when an EEM event is published. EEM scripts and policies are
identified to the EEM using the event manager policy configuration command. An EEM script remains
available to be scheduled by the EEM until the no event manager policy command is entered.
The EEM uses these two types of EEM scripts:
• Regular EEM scripts identified to the EEM through the eem script CLI command. Regular EEM scripts
• EEM callback scripts identified to the EEM when a process or EEM script registers to handle an event.
This example shows the usage for the CLI in scripts:
sjc-cde-010:/tftpboot/cnwei/fm> cat test_cli_eem.tcl
::cisco::eem::event_register_syslog occurs 1 pattern $_syslog_pattern maxrun 90
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
set errorInfo ""
# 1. query the information of latest triggered fm event
array set arr_einfo [event_reqinfo]
if {$_cerrno != 0} {
}
set msg $arr_einfo(msg)
set config_cmds ""
# 2. execute the user-defined config commands
if [catch {cli_open} result] {
} else {
}
if [catch {cli_exec $cli1(fd) "config"} result] {
}
if {[info exists _config_cmd1]} {
}
if {[info exists _config_cmd2]} {
}
if [catch {cli_exec $cli1(fd) "end"} result] {
Cisco ASR 9000 Series Aggregation Services Router System Monitoring Configuration Guide, Release 4.2.x
44
are standalone scripts that incorporate the definition of the event they will handle.
EEM callback scripts are essentially named functions that are identified to the EEM through the C
Language API.
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
error $result $errorInfo
array set cli1 $result
error $result $errorInfo
if [catch {cli_exec $cli1(fd) $_config_cmd1} result] {
error $result $errorInfo
}
append config_cmds $_config_cmd1
if [catch {cli_exec $cli1(fd) $_config_cmd2} result] {
error $result $errorInfo
}
append config_cmds "\n"
append config_cmds $_config_cmd2
error $result $errorInfo
Configuring and Managing Embedded Event Manager Policies

Advertisement

Table of Contents
loading

Table of Contents