Table Of Contents
Writing Embedded Event Manager Policies Using Tcl
Contents
Prerequisites for Writing Embedded Event Manager Policies Using Tcl
Information About Writing Embedded Event Manager Policies Using Tcl
EEM Policies
EEM Event Detectors Available by Cisco IOS Release
EEM Actions Available by Cisco IOS Release
EEM Policy Tcl Command Extension Categories
General Flow of EEM Event Detection and Recovery
Safe-Tcl
Cisco File Naming Convention for EEM
How to Write Embedded Event Manager Policies Using Tcl
Registering and Defining an EEM Tcl Script
Prerequisites
Examples
Displaying EEM Registered Policies
Unregistering EEM Policies
Examples
Suspending EEM Policy Execution
Examples
Managing EEM Policies
Examples
Modifying History Table Size and Displaying EEM History Data
Displaying Software Modularity Process Reliability Metrics Using EEM
Troubleshooting Tips
Modifying the Sample EEM Policies
Sample EEM Policies
Programming EEM Policies with Tcl
Tcl Policy Structure and Requirements
EEM Entry Status
EEM Exit Status
EEM Policies and Cisco Error Number
Troubleshooting Tips
Creating an EEM User Tcl Library Index
Creating an EEM User Tcl Package Index
Configuration Examples for Writing Embedded Event Manager Policies Using Tcl
Assigning a Username for a Tcl Session: Example
EEM Event Detector Demo: Example
Programming Policies with Tcl: Sample Scripts Example
Debugging Embedded Event Manager Policies: Examples
Tracing Tcl set Command Operations: Example
Where to Go Next
Additional References
Related Documents
Standards
MIBs
RFCs
Technical Assistance
EEM Policy Tcl Command Extension Reference
EEM Event Registration Tcl Command Extensions
event_register_appl
event_register_cli
event_register_counter
event_register_gold
event_register_interface
event_register_ioswdsysmon
event_register_none
event_register_oir
event_register_process
event_register_resource
event_register_rf
event_register_snmp
event_register_syslog
event_register_timer
event_register_timer_subscriber
event_register_track
event_register_wdsysmon
EEM Event Information Tcl Command Extension
event_reqinfo
EEM Event Publish Tcl Command Extension
event_publish
EEM Action Tcl Command Extensions
action_force_switchover
action_policy
action_process
action_program
action_reload
action_script
action_snmp_trap
action_syslog
action_track_read
action_track_set
EEM Utility Tcl Command Extensions
appl_read
appl_reqinfo
appl_setinfo
counter_modify
fts_get_stamp
register_counter
register_timer
timer_arm
timer_cancel
unregister_counter
EEM System Information Tcl Command Extensions
sys_reqinfo_cli_freq
sys_reqinfo_cli_history
sys_reqinfo_cpu_all
sys_reqinfo_crash_history
sys_reqinfo_mem_all
sys_reqinfo_proc
sys_reqinfo_proc_all
sys_reqinfo_routername
sys_reqinfo_snmp
sys_reqinfo_syslog_freq
sys_reqinfo_syslog_history
EEM Library Debug Command Extensions
cli_debug
smtp_debug
SMTP Library Command Extensions
smtp_send_email
smtp_subst
CLI Library Command Extensions
cli_close
cli_exec
cli_get_ttyname
cli_open
cli_read
cli_read_drain
cli_read_line
cli_read_pattern
cli_write
Tcl Context Library Command Extensions
context_retrieve
context_save
Feature Information for Writing Embedded Event Manager Policies Using Tcl
Writing Embedded Event Manager Policies Using Tcl
First Published: October 31, 2005
Last Updated: February 28, 2007
This module describes how software developers can write and customize Embedded Event Manager (EEM) policies using Tool command language (Tcl) scripts to handle Cisco IOS software faults and events. EEM is a policy-driven process by means of which faults in the Cisco IOS software system are reported through a defined application programing interface (API). The EEM policy engine receives notifications when faults and other events occur. EEM policies implement recovery on the basis of the current state of the system and the actions specified in the policy for a given event. Recovery actions are triggered when the policy is run.
Finding Feature Information in This Module
Your Cisco IOS software release may not support all of the features documented in this module. To reach links to specific feature documentation in this module and to see a list of the releases in which each feature is supported, use the "Feature Information for Writing Embedded Event Manager Policies Using Tcl" section.
Finding Support Information for Platforms and Cisco IOS and Catalyst OS Software Images
Use Cisco Feature Navigator to find information about platform support and Cisco IOS and Catalyst OS software image support. To access Cisco Feature Navigator, go to http://www.cisco.com/go/cfn. An account on Cisco.com is not required.
Contents
•
Prerequisites for Writing Embedded Event Manager Policies Using Tcl
•
Information About Writing Embedded Event Manager Policies Using Tcl
•
How to Write Embedded Event Manager Policies Using Tcl
•
Configuration Examples for Writing Embedded Event Manager Policies Using Tcl
•
Where to Go Next
•
Additional References
•
EEM Policy Tcl Command Extension Reference
•
Feature Information for Writing Embedded Event Manager Policies Using Tcl
Prerequisites for Writing Embedded Event Manager Policies Using Tcl
•
Before writing EEM policies, you should be familiar with the "Embedded Event Manager Overview" module.
•
If you want to write EEM policies using the command-line interface (CLI) commands, you should be familiar with the "Writing Embedded Event Manager Policies Using the Cisco IOS CLI" module.
Information About Writing Embedded Event Manager Policies Using Tcl
To write EEM policies using Tcl, you should understand the following concepts:
•
EEM Policies
•
EEM Event Detectors Available by Cisco IOS Release
•
EEM Actions Available by Cisco IOS Release
•
EEM Policy Tcl Command Extension Categories
•
General Flow of EEM Event Detection and Recovery
•
Safe-Tcl
•
Cisco File Naming Convention for EEM
EEM Policies
EEM offers the ability to monitor events and take informational or corrective action when the monitored events occur or reach a threshold. An EEM policy is an entity that defines an event and the actions to be taken when that event occurs. There are two types of EEM policies: an applet or a script. An applet is a simple form of policy that is defined within the command-line interface (CLI) configuration. A script is a form of policy that is written in Tool Command Language (Tcl).
EEM Applet
An EEM applet is a concise method for defining event screening criteria and the actions to be taken when that event occurs. In EEM applet configuration mode, three types of configuration statements are supported. The event commands are used to specify the event criteria to trigger the applet to run, the action commands are used to specify an action to perform when the EEM applet is triggered, and the set command is used to set the value of an EEM applet variable. Currently only the _exit_status variable is supported for the set command.
Only one event configuration command is allowed within an applet configuration. When applet configuration submode is exited and no event command is present, a warning is displayed stating that no event is associated with the applet. If no event is specified, the applet is not considered registered. When no action is associated with the applet, events are still triggered but no actions are performed. Multiple action configuration commands are allowed within an applet configuration. Use the show event manager policy registered command to display a list of registered applets.
Before modifying an EEM applet, be aware that the existing applet is not replaced until you exit applet configuration mode. While you are in applet configuration mode modifying the applet, the existing applet may be executing. It is safe to modify the applet without unregistering it, because changes are written to a temporary file. When you exit applet configuration mode, the old applet is unregistered and the new version is registered.
Action configuration commands within an applet are uniquely identified using the label argument, which can be any string value. Actions are sorted within an applet in ascending alphanumeric key sequence using the label argument as the sort key, and they are run using this sequence. The same label argument can be used in different applets; the labels must be unique only within one applet.
The Embedded Event Manager schedules and runs policies on the basis of an event specification that is contained within the policy itself. When applet configuration mode is exited, EEM examines the event and action commands that are entered and registers the applet to be run when a specified event occurs.
For more details about writing EEM policies using the Cisco IOS CLI, see the "Writing Embedded Event Manager Policies Using the Cisco IOS CLI" module.
EEM Script
All Embedded Event Manager scripts are written in Tcl. Tcl is a string-based command language that is interpreted at run time. The version of Tcl supported is Tcl version 8.3.4 plus added script support. Scripts are defined using an ASCII editor on another device, not on the networking device. The script is then copied to the networking device and registered with EEM. Tcl scripts are supported by EEM. As an enforced rule, Embedded Event Manager policies are short-lived run time routines that must be interpreted and executed in less than 20 seconds of elapsed time. If more than 20 seconds of elapsed time are required, the maxrun parameter may be specified in the event_register statement to specify any desired value.
EEM policies use the full range of the Tcl language's capabilities. However, Cisco provides enhancements to the Tcl language in the form of Tcl command extensions that facilitate the writing of EEM policies. The main categories of Tcl command extensions identify the detected event, the subsequent action, utility information, counter values, and system information.
EEM allows you to write and implement your own policies using Tcl. Writing an EEM script involves:
•
Selecting the event Tcl command extension that establishes the criteria used to determine when the policy is run.
•
Defining the event detector options associated with detecting the event.
•
Choosing the actions to implement recovery or respond to the detected event.
EEM Event Detectors Available by Cisco IOS Release
EEM uses software programs known as event detectors to determine when an EEM event occurs. Some event detectors are available in every Cisco IOS release, but most event detectors have been introduced in a specific release. Use Table 1 to determine which event detectors are available in your specific Cisco IOS release. A blank entry (—) indicates that the event detector is not available; the text "Yes" indicates that the event detector is available. The event detectors shown in Table 1 are supported in later releases of the same Cisco IOS release train. For more details on each event detector, see the Event Detectors concept in the "Embedded Event Manager Overview" module.
Table 1 Availability of Event Detectors by Cisco IOS Release
Event Detector
|
12.0(26)S 12.3(4)T
|
12.2(25)S
|
12.3(14)T 12.2(18)SXF5 12.2(28)SB 12.2(33)SRA
|
12.4(2)T 12.2(31)SB3 12.2(33)SRB
|
12.2(18)SXF4 Cisco IOS Software Modularity
|
Application-Specific
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
CLI
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Counter
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Enhanced Object Tracking
|
—
|
—
|
—
|
Yes
|
—
|
GOLD
|
—
|
—
|
—
|
—
|
Yes
|
Interface Counter
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
None
|
—
|
—
|
Yes
|
Yes
|
Yes
|
OIR
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Resource
|
—
|
—
|
—
|
Yes
|
—
|
RF
|
—
|
—
|
—
|
Yes
|
Yes
|
SNMP
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Syslog
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
System Manager
|
—
|
—
|
—
|
—
|
Yes
|
Timer
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Watchdog (Cisco IOS)
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Watchdog (Cisco IOS Software Modularity)
|
—
|
—
|
—
|
—
|
Yes
|
EEM Actions Available by Cisco IOS Release
The CLI-based corrective actions that are taken when event detectors report events enable a powerful on-device event management mechanism. Some actions are available in every Cisco IOS release, but most actions have been introduced in a specific release. Use Table 2 to determine which actions are available in your specific Cisco IOS release. A blank entry (—) indicates that the action is not available; the text "Yes" indicates that the action is available. The actions shown in Table 2 are supported in later releases of the same Cisco IOS release train. For more details on each action, see the Embedded Event Actions concept in the "Embedded Event Manager Overview" module.
Table 2 Availability of Actions by Cisco IOS Release
Action
|
12.0(26)S 12.3(4)T
|
12.2(25)S
|
12.3(14)T 12.2(18)SXF5 12.2(28)SB 12.2(33)SRA
|
12.4(2)T 12.2(31)SB3 12.2(33)SRB
|
12.2(18)SXF4 Cisco IOS Software Modularity
|
Execute a CLI command
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Generate a CNS event
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Generate an SNMP trap
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Generate a prioritized syslog message
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Manually run an EEM policy
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Publish an application-specific event
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Read the state of a tracked object
|
—
|
—
|
—
|
Yes
|
—
|
Reload the Cisco IOS software
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Request system information
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Send a short e-mail
|
—
|
—
|
Yes
|
Yes
|
Yes
|
Set or modify a counter
|
—
|
Yes
|
Yes
|
Yes
|
Yes
|
Set the state of a tracked object
|
—
|
—
|
—
|
Yes
|
—
|
Switch to a secondary RP
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
EEM Policy Tcl Command Extension Categories
There are different categories of EEM policy Tcl command extensions.
Note
The Tcl command extensions available in each of these categories for use in all EEM policies are described in later sections in this document.
Table 3 EEM Policy Tcl Command Extension Categories
Category
|
Definition
|
EEM event Tcl command extensions (three types: event information, event registration, and event publish)
|
This category is represented by the event_register_xxx family of event-specific commands. There is a separate event information Tcl command extension in this category as well: event_reqinfo. This is the command used in policies to query the EEM for information about an event. There is also an EEM event publish Tcl command extension event_publish that publishes an application-specific event.
|
EEM action Tcl command extensions
|
These Tcl command extensions (for example, action_syslog) are used by policies to respond to or recover from an event or fault. In addition to these extensions, developers can use the Tcl language to implement any action desired.
|
EEM utility Tcl command extensions
|
These Tcl command extensions are used to retrieve, save, set, or modify application information, counters, or timers.
|
EEM system information Tcl command extensions
|
This category is represented by the sys_reqinfo_xxx family of system-specific information commands. These commands are used by a policy to gather system information.
|
EEM context Tcl command extensions
|
These Tcl command extensions are used to store and retrieve a Tcl context (the visible variables and their values).
|
General Flow of EEM Event Detection and Recovery
EEM is a flexible, policy-driven framework that supports in-box monitoring of different components of the system with the help of software agents known as event detectors. Figure 1 shows the relationship between the EEM server, the core event publishers (event detectors), and the event subscribers (policies). Basically, event publishers screen events and publish them when there is a match on an event specification that is provided by the event subscriber. Event detectors notify the EEM server when an event of interest occurs.
When an event or fault is detected, Embedded Event Manager determines from the event publishers—an example would be the OIR events publisher in Figure 1—if a registration for the encountered fault or event has occurred. EEM matches the event registration information with the event data itself. A policy registers for the detected event with the Tcl command extension event_register_xxx. The event information Tcl command extension event_reqinfo is used in the policy to query the Embedded Event Manager for information about the detected event.
Figure 1 Embedded Event Manager Core Event Detectors
Safe-Tcl
Safe-Tcl is a safety mechanism that allows untrusted Tcl scripts to run in an interpreter that was created in the safe mode. The safe interpreter has a restricted set of commands that prevent accessing some system resources and harming the host and other applications. For example, it does not allow commands to access critical Cisco IOS file system directories.
Cisco-defined scripts run in full Tcl mode, but user-defined scripts run in Safe-Tcl mode. Safe-Tcl allows Cisco to disable or customize individual Tcl commands. For more details about Tcl commands, go to http://www.tcl.tk/man/.
The following list of Tcl commands are restricted with a few exceptions. Restrictions are noted against each command or command keyword:
•
cd—Change directory is not allowed to one of the restricted Cisco directory names.
•
encoding—The commands encoding names, encoding convertfrom, and encoding convertto are permitted. The encoding system command with no arguments is permitted, but the encoding system command with the ?encoding? keyword is not permitted.
•
exec—Not permitted.
•
fconfigure—Permitted.
•
file—The following are permitted:
–
file dirname
–
file exists
–
file extension
–
file isdirectory
–
file join
–
file pathtype
–
file rootname
–
file split
–
file stat
–
file tail
•
file—The following are not permitted:
–
file atime
–
file attributes
–
file channels
–
file copy
–
file delete
–
file executable
–
file isfile
–
file link
–
file lstat
–
file mkdir
–
file mtime
–
file nativename
–
file normalize
–
file owned
–
file readable
–
file readlink
–
file rename
–
file rootname
–
file separator
–
file size
–
file system
–
file type
–
file volumes
–
file writable
•
glob—The glob command is not permitted when searching in one of the restricted Cisco directories. Otherwise, it is permitted.
•
load—Only files that are in the user policy directory or the user library directory are permitted to be loaded. Static packages (for example, libraries that consist of C code) are not permitted to be loaded with the load command.
•
open—The open command is not allowed for a file that is located in one of the restricted Cisco directories.
•
pwd—The pwd command is not permitted.
•
socket—The socket command is permitted.
•
source—The source command is permitted for files that are in the user policy directory or the user library directory.
Cisco File Naming Convention for EEM
All Embedded Event Manager policy names, policy support files (for example, e-mail template files), and library filenames are consistent with the Cisco file naming convention. In this regard, Embedded Event Manager policy filenames adhere to the following specification:
•
An optional prefix—Mandatory.—indicating, if present, that this is a system policy that should be registered automatically at boot time if it is not already registered. For example: Mandatory.sl_text.tcl.
•
A filename body part containing a two-character abbreviation (see Table 4) for the first event specified; an underscore part; and a descriptive field part that further identifies the policy.
•
A filename suffix part defined as .tcl.
Embedded Event Manager e-mail template files consist of a filename prefix of email_template, followed by an abbreviation that identifies the usage of the e-mail template.
Embedded Event Manager library filenames consist of a filename body part containing the descriptive field that identifies the usage of the library, followed by _lib, and a filename suffix part defined as .tcl.
Table 4 Two-Character Abbreviation Specification
ap
|
event_register_appl
|
cl
|
event_register_cli
|
ct
|
event_register_counter
|
go
|
event_register_gold
|
if
|
event_register_interface
|
io
|
event_register_ioswdsysmon
|
no
|
event_register_none
|
oi
|
event_register_oir
|
pr
|
event_register_process
|
rf
|
event_register_rf
|
rs
|
event_register_resource
|
sl
|
event_register_syslog
|
sn
|
event_register_snmp
|
tm
|
event_register_timer
|
tr
|
event_register_track
|
ts
|
event_register_timer_subscriber
|
wd
|
event_register_wdsysmon
|
How to Write Embedded Event Manager Policies Using Tcl
This section contains the following tasks:
•
Registering and Defining an EEM Tcl Script
•
Displaying EEM Registered Policies
•
Unregistering EEM Policies
•
Suspending EEM Policy Execution
•
Managing EEM Policies
•
Modifying History Table Size and Displaying EEM History Data
•
Displaying Software Modularity Process Reliability Metrics Using EEM
•
Modifying the Sample EEM Policies
•
Programming EEM Policies with Tcl
•
Creating an EEM User Tcl Library Index
•
Creating an EEM User Tcl Package Index
Registering and Defining an EEM Tcl Script
Perform this task to configure environment variables and register an EEM policy. EEM schedules and runs policies on the basis of an event specification that is contained within the policy itself. When an EEM policy is registered, the software examines the policy and registers it to be run when the specified event occurs.
Prerequisites
You must have a policy available that is written in the Tcl scripting language. Sample policies are provided—see the details in the "Sample EEM Policies" section to see which policies are available for the Cisco IOS release image that you are using—and these sample policies are stored in the system policy directory.
SUMMARY STEPS
1.
enable
2.
show event manager environment [all | variable-name]
3.
configure terminal
4.
event manager environment variable-name string
5.
Repeat Step 4 to configure all the environment variables required by the policy to be registered in Step 6.
6.
event manager policy policy-filename [type {system | user}] [trap]
7.
exit
DETAILED STEPS
| |
Command or Action
|
Purpose
|
Step 1
|
enable
Example:
Router> enable
|
Enables privileged EXEC mode.
• Enter your password if prompted.
|
Step 2
|
show event manager environment [all |
variable-name]
Example:
Router# show event manager environment all
|
(Optional) Displays the name and value of EEM environment variables.
• The optional all keyword displays all the EEM environment variables.
• The optional variable-name argument displays information about the specified environment variable.
|
Step 3
|
configure terminal
Example:
Router# configure terminal
|
Enters global configuration mode.
|
Step 4
|
event manager environment variable-name string
Example:
Router(config)# event manager environment
_cron_entry 0-59/2 0-23/1 * * 0-6
|
Configures the value of the specified EEM environment variable.
• In this example, the software assigns a CRON timer environment variable to be set to the second minute of every hour of every day.
|
Step 5
|
Repeat Step 4 to configure all the environment variables required by the policy to be registered in Step 6.
|
—
|
Step 6
|
event manager policy policy-filename [type
{system | user}] [trap]
Example:
Router(config)# event manager policy
tm_cli_cmd.tcl type system
|
Registers the EEM policy to be run when the specified event defined within the policy occurs.
• Use the system keyword to register a Cisco-defined system policy.
• Use the user keyword to register a user-defined system policy.
• Use the trap keyword to generate an SNMP trap when the policy is triggered.
• In this example, the sample EEM policy named tm_cli_cmd.tcl is registered as a system policy.
|
Step 7
|
exit
Example:
Router(config)# exit
|
Exits global configuration mode and returns to privileged EXEC mode.
|
Examples
In the following example, the show event manager environment privileged EXEC command is used to display the name and value of all EEM environment variables.
Router# show event manager environment all
1 _cron_entry 0-59/2 0-23/1 * * 0-6
3 _syslog_pattern .*UPDOWN.*Ethernet1/0.*
4 _config_cmd1 interface Ethernet1/0
Displaying EEM Registered Policies
Perform this optional task to display EEM registered policies.
SUMMARY STEPS
1.
enable
2.
show event manager policy registered [event-type event-name] [time-ordered | name-ordered] [detailed policy-filename]
DETAILED STEPS
Step 1
enable
Enables privileged EXEC mode. Enter your password if prompted.
Step 2
show event manager policy registered [event-type event-name] [time-ordered | name-ordered] [detailed policy-filename]
Use this command with the time-ordered keyword to display information about currently registered policies sorted by time, for example:
Router# show event manager policy registered time-ordered
No. Type Event Type Trap Time Registered Name
1 system timer cron Off Wed May11 01:43:18 2005 tm_cli_cmd.tcl
name {crontimer2} cron entry {0-59/1 0-23/1 * * 0-7}
nice 0 priority normal maxrun 240
2 system syslog Off Wed May11 01:43:28 2005 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90
3 system proc abort Off Wed May11 01:43:38 2005 pr_cdp_abort.tcl
instance 1 path {cdp2.iosproc}
nice 0 priority normal maxrun 20
Use this command with the name-ordered keyword to display information about currently registered policies sorted by name, for example:
Router# show event manager policy registered name-ordered
No. Type Event Type Trap Time Registered Name
1 system proc abort Off Wed May11 01:43:38 2005 pr_cdp_abort.tcl
instance 1 path {cdp2.iosproc}
nice 0 priority normal maxrun 20
2 system syslog Off Wed May11 01:43:28 2005 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90
3 system timer cron Off Wed May11 01:43:18 2005 tm_cli_cmd.tcl
name {crontimer2} cron entry {0-59/1 0-23/1 * * 0-7}
nice 0 priority normal maxrun 240
Use this command with the event-type keyword to display information about currently registered policies for the event type specified in the event-name argument, for example:
Router# show event manager policy registered event-type syslog
No. Type Event Type Time Registered Name
1 system syslog Wed May11 01:43:28 2005 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90
Unregistering EEM Policies
Perform this task to remove an EEM policy from the running configuration file. Execution of the policy is canceled.
SUMMARY STEPS
1.
enable
2.
show event manager policy registered [event-type event-name] [system | user] [time-ordered | name-ordered] [detailed policy-filename]
3.
configure terminal
4.
no event manager policy policy-filename
5.
exit
6.
Repeat Step 2 to ensure that the policy has been removed.
DETAILED STEPS
| |
Command or Action
|
Purpose
|
Step 1
|
enable
Example:
Router> enable
|
Enables privileged EXEC mode.
• Enter your password if prompted.
|
Step 2
|
show event manager policy registered
[event-type event-name] [system | user]
[time-ordered | name-ordered] [detailed
policy-filename]
Example:
Router# show event manager policy registered
|
(Optional) Displays the EEM policies that are currently registered.
• The optional system or user keyword displays the registered system or user policies.
• If no keywords are specified, EEM registered policies for all event types are displayed in time order.
|
Step 3
|
configure terminal
Example:
Router# configure terminal
|
Enters global configuration mode.
|
Step 4
|
no event manager policy policy-filename
Example:
Router(config)# no event manager policy
pr_cdp_abort.tcl
|
Removes the EEM policy from the configuration, causing the policy to be unregistered.
• In this example, the no form of the command is used to unregister a specified policy.
|
Step 5
|
exit
Example:
Router(config)# exit
|
Exits global configuration mode and returns to privileged EXEC mode.
|
Step 6
|
Repeat Step 2 to ensure that the policy has been removed.
Example:
Router# show event manager policy registered
|
—
|
Examples
In the following example, the show event manager policy registered privileged EXEC command is used to display the three EEM policies that are currently registered:
Router# show event manager policy registered
No. Type Event Type Trap Time Registered Name
1 system timer cron Off Tue Oct11 01:43:18 2005 tm_cli_cmd.tcl
name {crontimer2} cron entry {0-59/1 0-23/1 * * 0-7}
nice 0 priority normal maxrun 240.000
2 system syslog Off Tue Oct11 01:43:28 2005 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90.000
3 system proc abort Off Tue Oct11 01:43:38 2005 pr_cdp_abort.tcl
instance 1 path {cdp2.iosproc}
nice 0 priority normal maxrun 20.000
After the current policies are displayed, it is decided to delete the pr_cdp_abort.tcl policy using the no form of the event manager policy command:
Router# configure terminal
Router(config)# no event manager policy pr_cdp_abort.tcl
The show event manager policy registered privileged EXEC command is entered again to display the EEM policies that are currently registered. The policy pr_cdp_abort.tcl is no longer registered.
Router# show event manager policy registered
No. Type Event Type Trap Time Registered Name
1 system timer cron Off Tue Oct11 01:45:17 2005 tm_cli_cmd.tcl
name {crontimer2} cron entry {0-59/1 0-23/1 * * 0-7}
nice 0 priority normal maxrun 240.000
2 system syslog Off Tue Oct11 01:45:27 2005 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90.000
Suspending EEM Policy Execution
Perform this task to immediately suspend the execution of all EEM policies. Suspending policies, instead of unregistering them, might be necessary for reasons of temporary performance or security.
SUMMARY STEPS
1.
enable
2.
show event manager policy registered [event-type event-name] [system | user] [time-ordered | name-ordered] [detailed policy-filename]
3.
configure terminal
4.
event manager scheduler suspend
5.
exit
DETAILED STEPS
| |
Command or Action
|
Purpose
|
Step 1
|
enable
Example:
Router> enable
|
Enables privileged EXEC mode.
• Enter your password if prompted.
|
Step 2
|
show event manager policy registered
[event-type event-name] [system | user]
[time-ordered | name-ordered] [detailed
policy-filename]
Example:
Router# show event manager policy registered
|
(Optional) Displays the EEM policies that are currently registered.
• The optional system or user keyword displays the registered system or user policies.
• If no keywords are specified, EEM registered policies for all event types are displayed in time order.
|
Step 3
|
configure terminal
Example:
Router# configure terminal
|
Enters global configuration mode.
|
Step 4
|
event manager scheduler suspend
Example:
Router(config)# event manager scheduler suspend
|
Immediately suspends the execution of all EEM policies.
|
Step 5
|
exit
Example:
Router(config)# exit
|
Exits global configuration mode and returns to privileged EXEC mode.
|
Examples
In the following example, the show event manager policy registered privileged EXEC command is used to display all the EEM registered policies:
Router# show event manager policy registered
No. Type Event Type Trap Time Registered Name
1 system timer cron Off Sat Oct11 01:43:18 2003 tm_cli_cmd.tcl
name {crontimer2} cron entry {0-59/1 0-23/1 * * 0-7}
nice 0 priority normal maxrun 240.000
2 system syslog Off Sat Oct11 01:43:28 2003 sl_intf_down.tcl
occurs 1 pattern {.*UPDOWN.*Ethernet1/0.*}
nice 0 priority normal maxrun 90.000
3 system proc abort Off Sat Oct11 01:43:38 2003 pr_cdp_abort.tcl
instance 1 path {cdp2.iosproc}
nice 0 priority normal maxrun 20.000
The event manager scheduler suspend command is entered to immediately suspend the execution of all EEM policies:
Router# configure terminal
Router(config)# event manager scheduler suspend
*Nov 2 15:34:39.000: %HA_EM-6-FMS_POLICY_EXEC: fh_io_msg: Policy execution has been
suspended
Managing EEM Policies
Perform this task to specify a directory to use for storing user library files or user-defined EEM policies.
Note
This task applies only to EEM policies that are written using Tcl scripts.
SUMMARY STEPS
1.
enable
2.
show event manager directory user [library | policy]
3.
configure terminal
4.
event manager directory user {library path | policy path}
5.
exit
DETAILED STEPS
| |
Command or Action
|
Purpose
|
Step 1
|
enable
Example:
Router> enable
|
Enables privileged EXEC mode.
• Enter your password if prompted.
|
Step 2
|
show event manager directory user [library |
policy]
Example:
Router# show event manager directory user
library
|
(Optional) Displays the directory to use for storing EEM user library or policy files.
• The optional library keyword displays the directory to use for user library files.
• The optional policy keyword displays the directory to use for user-defined EEM policies.
|
Step 3
|
configure terminal
Example:
Router# configure terminal
|
Enters global configuration mode.
|
Step 4
|
event manager directory user {library path |
policy path}
Example:
Router(config)# event manager directory user
library disk0:/usr/lib/tcl
|
Specifies a directory to use for storing user library files or user-defined EEM policies.
• Use the path argument to specify the absolute pathname to the user directory.
|
Step 5
|
exit
Example:
Router(config)# exit
|
Exits global configuration mode and returns to privileged EXEC mode.
|
Examples
In the following example, the show event manager directory user privileged EXEC command is used to display the directory, if it exists, to use for storing EEM user library files:
Router# show event manager directory user library
Modifying History Table Size and Displaying EEM History Data
Perform this optional task to change the size of the history tables and to display EEM history data.
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
event manager history size {events | traps} [size]
4.
exit
5.
show event manager history events [detailed] [maximum number]
6.
show event manager history traps {server | policy}
DETAILED STEPS
Step 1
enable
Enables privileged EXEC mode. Enter your password if prompted.
Step 2
configure terminal
Enters global configuration mode.
Router# configure terminal
Step 3
event manager history size {events | traps} [size]
Use this command to change the size of the EEM event history table or the size of the EEM SNMP trap history table. In the following example, the size of the EEM event history table is changed to 30 entries:
Router(config)# event manager history size events 30
Step 4
exit
Exits global configuration mode and returns to privileged EXEC mode.
Step 5
show event manager history events [detailed] [maximum number]
Use this command to display information about each EEM event that has been triggered.
Router# show event manager history events
No. Time of Event Event Type Name
1 Fri Sep 9 13:48:40 2005 syslog applet: one
2 Fri Sep 9 13:48:40 2005 syslog applet: two
3 Fri Sep 9 13:48:40 2005 syslog applet: three
4 Fri Sep 9 13:50:00 2005 timer cron script: tm_cli_cmd.tcl
5 Fri Sep 9 13:51:00 2005 timer cron script: tm_cli_cmd.tcl
Step 6
show event manager history traps [server | policy]
Use this command to display the EEM SNMP traps that have been sent either from the EEM server or from an EEM policy.
Router# show event manager history traps
1 Fri Sep 9 13:48:40 2005 server applet: four
2 Fri Sep 9 13:57:03 2005 policy script: no_snmp_test.tcl
Displaying Software Modularity Process Reliability Metrics Using EEM
Perform this optional task to display reliability metrics for Cisco IOS Software Modularity processes. The show event manager metric processes command was introduced in Cisco IOS Release 12.2(18)SXF4 and later releases and is supported only in Software Modularity images.
SUMMARY STEPS
1. 