Embedded Event Manager
Embedded Event Manager
34
Understanding Embedded Event Manager, page 34-1 Configuring Embedded Event Manager, page 34-5 Displaying Embedded Event Manager Information, page 34-7
34-1
Figure 34-1
Core event publishers Cisco IOS parser text Syslog message queue OIR events event manager run CLI command Hardware timers
Event subscribers
EEM POLICY DIRECTOR Subscribes to receive events and implements policy actions
EEM APPLET
EEM SCRIPT
See the EEM Configuration for Cisco Integrated Services Router Platforms Guide for examples of EEM deployment.
Event Detectors, page 34-2 Embedded Event Manager Actions, page 34-4 Embedded Event Manager Policies, page 34-4 Embedded Event Manager Environment Variables, page 34-4
Event Detectors
EEM software programs known as event detectors determine when an EEM event occurs. Event detectors are separate systems that provide an interface between the agent being monitored, for example SNMP, and the EEM policies where an action can be implemented. Event detectors are generated only by the master switch. CLI and routing processes also run only from the master switch.
Note
The stack member switch does not generate events and does not support memory threshold notifications or IOSWdSysmon event detectors.
Application-specific event detector Allows any EEM policy to publish an event. IOS CLI event detector Generates policies based on the commands entered through the CLI. Generic Online Diagnostics (GOLD) event detector Publishes an event when a GOLD failure event is detected on a specified card and subcard.
34-2
127574
OL-8550-07
Chapter 34
Counter event detectorPublishes an event when a named counter crosses a specified threshold. Interface counter event detector Publishes an event when a generic Cisco IOS interface counter for a specified interface crosses a defined threshold. A threshold can be specified as an absolute value or an incremental value. For example, if the incremental value is set to 50 an event would be published when the interface counter increases by 50. This detector also publishes an event about an interface based on the rate of change for the entry and exit values.
None event detector Publishes an event when the event manager run CLI command executes an EEM policy. EEM schedules and runs policies on the basis on an event specification within the policy itself. An EEM policy must be manually identified and registered before the event manager run command executes. Online insertion and removal event detectorPublishes an event when a hardware insertion or removal (OIR) event occurs. Resource threshold event detector Generates policies based on global platform values and thresholds. Includes resources such as CPU utilization and remaining buffer capacity. Applies only to the master switch. Remote procedure call (RPC) event detectorInvokes EEM policies from outside the switch over an encrypted connecting using Secure Shell (SSH) and uses Simple Object Access Protocol (SOAP) data encoding for exchanging XML-based messages. It also runs EEM policies and then gets the output in a SOAP XML-formatted reply. SNMP event detector Allows a standard SNMP MIB object to be monitored and an event to be generated when
The object matches specified values or crosses specified thresholds. The SNMP delta value, the difference between the monitored Object Identifier (OID) value at
the beginning the period and the actual OID value when the event is published, matches a specified value.
SNMP notification event detectorIntercepts SNMP trap and inform messages received by the switch. The event is generated when an incoming message matches a specified value or crosses a defined threshold. Syslog event detector Allows for screening syslog messages for a regular expression pattern match. The selected messages can be further qualified, requiring that a specific number of occurrences be logged within a specified time. A match on a specified event criteria triggers a configured policy action. Timer event detector Publishes events for
An absolute-time-of-day timer publishes an event when a specified absolute date and time
occurs.
A countdown timer publishes an event when a timer counts down to zero. A watchdog timer publishes an event when a timer counts down to zero. The timer automatically
resets itself to its initial value and starts to count down again.
A CRON timer publishes an event by using a UNIX standard CRON specification to define
when the event is to be published. A CRON timer never publishes events more than once per minute.
Watchdog event detector (IOSWDSysMon)Publishes an event only on the master switch when
CPU utilization for a Cisco IOS process crosses a threshold. Memory utilization for a Cisco IOS process crosses a threshold.
34-3
Two events can be monitored at the same time, and the event publishing criteria requires that one or both events cross their specified thresholds.
Modifying a named counter. Publishing an application-specific event. Generating an SNMP trap. Generating prioritized syslog messages. Reloading the Cisco IOS software. Reloading the switch stack. Reloading the master switch in the event of a master switchover. If this occurs, a new master switch is elected.
34-4
OL-8550-07
Chapter 34
Cisco-defined variables Defined by Cisco for a specific sample policy. Cisco built-in variables (available in EEM applets) Defined by Cisco and can be read-only or read-write. The read-only variables are set by the system before an applet starts to execute. The single read-write variable, _exit_status, allows you to set the exit status for policies triggered from synchronous events.
Cisco-defined environment variables and Cisco system-defined environment variables might apply to one specific event detector or to all event detectors. Environment variables that are user-defined or defined by Cisco in a sample policy are set by using the event manager environment global configuration command. You must defined the variables in the EEM policy before you register the policy. For information about the environmental variables that EEM supports, see the Cisco IOS Network Management Configuration Guide, Release 12.4T.
Registering and Defining an Embedded Event Manager Applet, page 34-5 Registering and Defining an Embedded Event Manager TCL Script, page 34-6
For complete information about configuring embedded event manager, see the Cisco IOS Network Management Configuration Guide, Release 12.4T.
Purpose Enter global configuration mode. Register the applet with EEM and enter applet configuration mode.
Specify the event criteria that causes the EEM applet to run. event snmp oid oid-value get-type {exact | next} entry-op {gt | ge | eq | ne | (Optional) Exit criteria. If exit criteria are not specified, event monitoring lt | le} entry-val entry-val [exit-comb is re-enabled immediately. {or | and}] [exit-op {gt | ge | eq | ne | lt | le}] [exit-val exit-val] [exit-time exit-time-val] poll-interval poll-int-val action label syslog [priority priority-level] msg msg-text Specify the action when an EEM applet is triggered. Repeat this action to add other CLI commands to the applet.
Step 4
(Optional) The priority keyword specifies the priority level of the syslog messages. If selected, you need to define the priority-level argument. For msg-text, the argument can be character text, an environment variable, or a combination of the two.
Step 5
end
34-5
This example shows the output for EEM when one of the fields specified by an SNMP object ID crosses a defined threshold:
Switch(config-applet)# event snmp oid 1.3.6.1.4.1.9.9.48.1.1.1.6.1 get-type exact entry-op lt entry-val 5120000 poll-interval 10
These examples show actions that are taken in response to an EEM event:
Switch(config-applet)# action 1.0 syslog priority critical msg "Memory exhausted; current available memory is $_snmp_oid_val bytes" Switch (config-applet)# action 2.0 force-switchover
Purpose Enter global configuration mode. (Optional) The show event manager environment command displays the name and value of the EEM environment variables. (Optional) The all keyword displays the EEM environment variables. (Optional) The variable-name argument displays information about the specified environment variable.
configure terminal
event manager environment Configure the value of the specified EEM environment variable. Repeat this step for variable-name string all the required environment variables. event manager policy policy-file-name [type system] [trap] exit Register the EEM policy to be run when the specified event defined within the policy occurs. Exit global configuration mode and return to privileged EXEC mode. This example shows the sample output for the show event manager environment command:
Switch# show event manager environment all No. Name Value 1 _cron_entry 0-59/2 0-23/1 * * 0-6 2 _show_cmd show ver 3 _syslog_pattern .*UPDOWN.*Ethernet1/0.* 4 _config_cmd1 interface Ethernet1/0 5 _config_cmd2 no shut
Step 5
This example shows a CRON timer environment variable, which is assigned by the software, to be set to every second minute, every hour of every day:
Switch (config)# event manager environment_cron_entry 0-59/2 0-23/1 * * 0-6
This example shows the sample EEM policy named tm_cli_cmd.tcl registered as a system policy. The system policies are part of the Cisco IOS image. User-defined TCL scripts must first be copied to flash memory.
Switch (config)# event manager policy tm_cli_cmd.tcl type system
34-6
OL-8550-07
Chapter 34
34-7
34-8
OL-8550-07