Guest

Cisco IOS Software Releases 12.4 T

Embedded Event Manager 2.2

Table Of Contents

Embedded Event Manager 2.2

Contents

Prerequisites for Embedded Event Manager 2.2

Information About Embedded Event Manager 2.2

Embedded Event Manager

Embedded Event Manager 2.2

Event Detectors

Embedded Event Manager Actions

Embedded Event Manager Environment Variables

Embedded Event Manager Policies

How to Configure Embedded Event Manager 2.2

Registering and Defining an Embedded Event Manager Applet

EEM Policies

Troubleshooting Tips

Registering and Defining an Embedded Event Manager Tcl Script

EEM Policies

Prerequisites

Examples

Registering and Defining an Embedded Event Manager Policy to Run Manually

Unregistering Embedded Event Manager Policies

Examples

Suspending Embedded Event Manager Policy Execution

Examples

Managing Embedded Event Manager Policies

Examples

Configuring and Tracking a Stub Object Using Embedded Event Manager

Enhanced Object Tracking

Examples

Displaying Embedded Event Manager History Data

Displaying Embedded Event Manager Registered Policies

Configuration Examples for Embedded Event Manager 2.2

Embedded Event Manager Applet Configuration: Example

Embedded Event Manager Manual Policy Execution: Example

Configuring and Tracking a Stub Object Using Embedded Event Manager: Example

Embedded Event Manager Watchdog System Monitor Event Detector Configuration: Example

EEM Event Detector Demo: Example

EEM Sample Policy Descriptions

Event Manager Environment Variables for the Sample Policies

Registration of Some EEM Policies

Basic Configuration Details for All Sample Policies

Using the Sample Policies

Where to Go Next

Additional References

Related Documents

Standards

MIBs

RFCs

Technical Assistance

Command Reference

action track read

action track set

default-state

event resource

event rf

event track

show track

track stub


Embedded Event Manager 2.2


Embedded Event Manager (EEM) is a distributed, scalable, and customized approach to event detection and recovery offered directly in a Cisco IOS device. EEM offers the ability to monitor events and take informational or corrective action when the monitored events occur or when a threshold is reached. An EEM policy is an entity that defines an event and the actions to be taken when that event occurs.

EEM 2.2 introduces some new event detectors and actions, including enhanced object tracking.

History for the Embedded Event Manager 2.2 Feature

Release
Modification

12.0(26)S

This feature was introduced.

12.3(4)T

Additional functionality was added, and this feature was integrated into Cisco IOS Release 12.3(4)T.

12.3(2)XE

This feature was integrated into Cisco IOS Release 12.3(2)XE.

12.2(25)S

Additional functionality was added, and this feature was integrated into Cisco IOS Release 12.2(25)S.

12.3(14)T

Additional functionality was added.

12.4(2)T

Additional functionality was added.


Finding Support Information for Platforms and Cisco IOS Software Images

Use Cisco Feature Navigator to find information about platform support and Cisco IOS software image support. Access Cisco Feature Navigator at http://www.cisco.com/go/fn. You must have an account on Cisco.com. If you do not have an account or have forgotten your username or password, click Cancel at the login dialog box and follow the instructions that appear.

Contents

Prerequisites for Embedded Event Manager 2.2

Information About Embedded Event Manager 2.2

How to Configure Embedded Event Manager 2.2

Configuration Examples for Embedded Event Manager 2.2

Where to Go Next

Additional References

Command Reference

Prerequisites for Embedded Event Manager 2.2

If the action cns-event command is used, access to a CNS Event gateway must be configured.

If the action force-switchover command is used, a secondary processor must be configured on the device.

If the action snmp-trap command is used, the snmp-server enable traps event-manager command must be enabled to permit SNMP traps to be sent from the Cisco IOS device to the SNMP server. Other relevant snmp-server commands must also be configured; for details see the action snmp-trap command page.

Information About Embedded Event Manager 2.2

To configure Embedded Event Manager 2.2, you should understand the following concepts:

Embedded Event Manager

Embedded Event Manager 2.2

Event Detectors

Embedded Event Manager Actions

Embedded Event Manager Environment Variables

Embedded Event Manager Policies

Embedded Event Manager

Event tracking and management has traditionally been performed by devices external to the networking device. Embedded Event Manager (EEM) has been designed to offer event management capability directly in Cisco IOS based devices. The on-device, proactive event management capabilities of EEM are useful because not all event management can be done off router because some problems compromise communication between the router and the external network management device. Capturing the state of the router during such situations can be invaluable in taking immediate recovery actions and gathering information to perform root-cause analysis. Network availability is also improved if automatic recovery actions are performed without the need to fully reboot the routing device.

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, 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 when an event of interest occurs. The EEM policies that are configured using the Cisco IOS command-line interface (CLI) then implement recovery on the basis of the current state of the system and the actions specified in the policy for the given event.

Figure 1 Embedded Event Manager Core Event Detectors

EEM offers the ability to monitor events and take informational or corrective action when the monitored events occur or when a threshold is reached. 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 CLI configuration. A script is a form of policy that is written in Tcl.

Embedded Event Manager 2.2

EEM 2.2 is supported in Cisco IOS Release 12.4(2)T and introduces some new features. EEM 2.2 introduces the following new event detectors:

Enhanced Object Tracking—The enhanced object tracking event detector publishes an event when the tracked object changes. Object tracking was first introduced into the Hot Standby Router Protocol (HSRP) as a simple tracking mechanism that allowed you to track the interface line-protocol state only. If the line-protocol state of the interface went down, the HSRP priority of the router was reduced, allowing another HSRP router with a higher priority to become active.

Enhanced object tracking provides complete separation between the objects to be tracked and the action to be taken by a client when a tracked object changes. Thus, several clients such as EEM, Virtual Router Redundancy Protocol (VRRP), or Gateway Load Balancing Protocol (GLBP) can register their interest with the tracking process, track the same object, and each take different action when the object changes. Each tracked object is identified by a unique number that is specified on the tracking command-line interface (CLI). Client processes use this number to track a specific object. The tracking process periodically polls the tracked objects and notes any change of value. The changes in the tracked object are communicated to interested client processes, either immediately or after a specified delay. The object values are reported as either up or down.

Resource—The resource event detector publishes an event when the Embedded Resource Manager (ERM) reports an event for the specified policy.

RF—The redundancy framework (RF) event detector publishes an event when one or more RF events occur during synchronization in a dual Route Processor (RP) system. The RF event detector can also detect an event when a dual RP system continuously switches from one RP to another RP (referred to as a ping-pong situation).

EEM 2.2 introduces the following actions:

Reading the state of a tracked object.

Setting the state of a tracked object.

Event Detectors

Embedded Event Manager (EEM) uses software programs known as event detectors to determine when an EEM event occurs. Event detectors are separate systems that provide an interface between the agent being monitored, for example Simple Network Management Protocol (SNMP), and the EEM policies where an action can be implemented. EEM 2.2 contains the following event detectors.

Application-Specific Event Detector

The application-specific event detector allows any Embedded Event Manager policy to publish an event.

CLI Event Detector

The CLI event detector screens command-line interface (CLI) commands for a regular expression match. When a match is found, an event is published. The match logic is performed on the fully expanded CLI command after the command is successfully parsed and before it is executed. The CLI event detector supports three publish modes:

Synchronous publishing of CLI events—The CLI command is not executed until the EEM policy exits, and the EEM policy can control whether the command is executed.

Asynchronous publishing of CLI events—The CLI event is published, and then the CLI command is executed.

Asynchronous publishing of CLI events with command skipping—The CLI event is published, but the CLI command is not executed.

Counter Event Detector

The counter event detector publishes an event when a named counter crosses a specified threshold. There are two or more participants that affect counter processing. The counter event detector can modify the counter, and one or more subscribers define the criteria that cause the event to be published. After a counter event has been published, the counter monitoring logic can be reset to start monitoring the counter immediately or it can be reset when a second threshold—called an exit value—is crossed.

Enhanced Object Tracking Event Detector

The enhanced object tracking event detector publishes an event when the status of a tracked object changes. Object tracking was first introduced into the Hot Standby Router Protocol (HSRP) as a simple tracking mechanism that allowed you to track the interface line-protocol state only. If the line-protocol state of the interface went down, the HSRP priority of the router was reduced, allowing another HSRP router with a higher priority to become active.

Object tracking was enhanced to provide complete separation between the objects to be tracked and the action to be taken by a client when a tracked object changes. Thus, several clients such as HSRP, VRRP, or GLBP can register their interest with the tracking process, track the same object, and each take different action when the object changes. Each tracked object is identified by a unique number that is specified on the tracking command-line interface (CLI). Client processes use this number to track a specific object. The tracking process periodically polls the tracked objects and notes any change of value. The changes in the tracked object are communicated to interested client processes, either immediately or after a specified delay. The object values are reported as either up or down.

Enhanced object tracking is now integrated with EEM to allow EEM to report on a status change of a tracked object and to allow enhanced object tracking to track EEM objects. A new type of tracking object—a stub object—is created. The stub object can be manipulated using the existing CLI commands that already allow tracked objects to be manipulated.

Interface Counter Event Detector

The 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. If the incremental value is set to 50, for example, an event would be published when the interface counter increases by 50.

After an interface counter event has been published, the interface counter monitoring logic is reset using two methods. The interface counter is reset either when a second threshold—called an exit value—is crossed or when an elapsed period of time occurs.

None Event Detector

The none event detector publishes an event when the Cisco IOS event manager run CLI command executes an EEM policy. EEM schedules and runs policies on the basis of an event specification that is contained within the policy itself. An EEM policy must be identified and registered to be permitted to run manually before the event manager run command will execute.

OIR Event Detector

The online insertion and removal (OIR) event detector publishes an event when one of the following hardware insertion or removal events occurs:

A card is removed.

A card is inserted.

Route Processors (RPs), line cards, or feature cards can be monitored for OIR events.

Resource Event Detector

The resource event detector publishes an event when the Embedded Resource Manager (ERM) reports an event for the specified policy. The ERM infrastructure tracks resource depletion and resource dependencies across processes and within a system to handle various error conditions. The error conditions are handled by providing an equitable sharing of resources between various applications. The ERM framework provides a communication mechanism for resource entities and allows communication between these resource entities from numerous locations. The ERM framework also helps in debugging the CPU and memory-related issues. The ERM monitors system resource usage to better understand scalability needs by allowing you to configure threshold values for resources such as the CPU, buffers, and memory. For more details about ERM, see the "Embedded Resource Manager" chapter of the
Cisco IOS Network Management Configuration Guide, Release 12.4.

RF Event Detector

The redundancy framework (RF) event detector publishes an event when one or more RF events occur during synchronization in a dual Route Processor (RP) system. The RF event detector can also detect an event when a dual RP system continuously switches from one RP to another RP (referred to as a ping-pong situation).

SNMP Event Detector

The 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.

Syslog Event Detector

The 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

The timer event detector publishes events for the following four different types of timers:

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 and then the timer automatically resets itself to its initial value and starts to count down again.

A CRON timer publishes an event using a UNIX standard CRON specification to indicate when the event is to be published. A CRON timer never publishes events more than once per minute.

Watchdog System Monitor Event Detector

The Cisco IOS watchdog system monitor event detector publishes an event when one of the following occurs:

CPU utilization for a Cisco IOS process crosses a threshold.

Memory utilization for a Cisco IOS process crosses a threshold.

Two events may be monitored at the same time, and the event publishing criteria can be specified to require one event or both events to cross their specified thresholds.

Embedded Event Manager Actions

The CLI-based corrective actions that are taken when event detectors report events enable a powerful on-device event management mechanism. EEM 2.2 supports the following actions:

Executing a Cisco IOS command-line interface (CLI) command.

Generating a CNS event for upstream processing by Cisco CNS devices.

Setting or modifying a named counter.

Switching to a secondary processor in a fully redundant hardware configuration.

Requesting system information when an event occurs.

Sending a short e-mail.

Manually running an EEM policy.

Publishing an application-specific event.

Reloading the Cisco IOS software.

Generating an SNMP trap.

Generating prioritized syslog messages.

Reading the state of a tracked object.

Setting the state of a tracked object.

Embedded Event Manager Environment Variables

Tool Command Language (Tcl) allows global variables to be defined that are known to all procedures within a Tcl script. EEM allows environment variables to be defined using a CLI command, the event manager environment command, for use within an EEM policy. All EEM environment variables are automatically assigned to Tcl global variables before a Tcl script is run. There are three different types of environment variables associated with Embedded Event Manager:

User-defined—Defined by you if you create an environment variable in a policy that you have written.

Cisco-defined—Defined by Cisco for a specific sample policy.

Cisco system-defined—Defined by Cisco and can be read only or read/write. The read only variables are set by the system when a policy starts to execute. The single read/write variable, _exit_status, allows you to set the exit status at policy exit for policies triggered from synchronous events.

Cisco-defined environment variables (see Table 1) and Cisco system-defined environment variables (see Table 2) may 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 using the event manager environment command. Variables that are used in the EEM policy must be defined before you register the policy. A policy contains a section called "Environment Must Define" that can be defined to check that any required environment variables are defined before the policy runs.


Note Cisco-defined environment variables begin with an underscore character (_). We strongly recommend that customers avoid the same naming convention to prevent naming conflicts.


Table 1 describes the Cisco-defined variables used in the sample EEM policies.

Table 1 Cisco-Defined Environmental Variables and Examples 

Environment Variable
Description
Example

_config_cmd1

The first configuration command that is executed.

interface Ethernet1/0

_config_cmd2

The second configuration command that is executed. This variable is optional and need not be specified.

no shutdown

_crash_reporter_debug

A value that identifies whether debug information for tm_crash_reporter.tcl will be enabled. This variable is optional and need not be specified.

1

_crash_reporter_url

The URL location to which the crash report is sent.

http://www.swpkg.cisco.internal.com/fm/interface_tm.cgi

_cron_entry

A CRON specification that determines when the policy will run. See the Writing Embedded Event Manager Policies document for more information about how to specify a cron entry.

0-59/1 0-23/1 * * 0-7

_email_server

A Simple Mail Transfer Protocol (SMTP) mail server used to send e-mail.

mailserver.customer.com

_email_to

The address to which e-mail is sent.

engineering@customer.com

_email_from

The address from which e-mail is sent.

devtest@customer.com

_email_cc

The address to which the e-mail must be copied.

manager@customer.com

_show_cmd

The CLI command to be executed when the policy is run.

show version

_syslog_pattern

A regular expression pattern match string that is used to compare syslog messages to determine when the policy runs.

.*UPDOWN.*FastEthernet0/0.*


Table 2 describes the Cisco system-defined environment variables that are read only.

Table 2 Cisco System-Defined Environment Variables (Read Only) 

Environment Variable
Description
All Events

_event_pub_time

The time at which the event type was published.

_event_type_string

The event type that triggered the event.

Application-Specific Event Detector

_application_component_id

The event application component identifier.

_application_data1

The value of an environment variable, character text, or a combination of the two to be passed to an application-specific event when the event is published.

_application_data2

The value of an environment variable, character text, or a combination of the two to be passed to an application-specific event when the event is published.

_application_data3

The value of an environment variable, character text, or a combination of the two to be passed to an application-specific event when the event is published.

_application_data4

The value of an environment variable, character text, or a combination of the two to be passed to an application-specific event when the event is published.

_application_sub_system

The event application subsystem number.

_application_type

The type of application.

CLI Event Detector

_cli_msg

The fully expanded message that triggered the CLI event.

_cli_msg_count

The number of times that a message match occurred before the event was published.

Counter Event Detector

_counter_name

The name of the counter.

_counter_value

The value of the counter.

Enhanced Object Tracking Event Detector

_track_number

The number of the tracked object.

_track_state

The state of the tracked object; down or up.

Interface Counter Event Detector

_interface_is_increment

A value to indicate whether the current interface counter value is an absolute value (0) or an increment value (1).

_interface_name

The name of the interface to be monitored.

_interface_parameter

The name of the interface counter to be monitored.

_interface_value

A value with which the current interface counter value is compared.

OIR Event Detector

_oir_event

A value of 1 indicates an insertion event; value of 2 indicates a removal event.

_oir_slot

The slot number for the OIR event.

Resource Event Detector

_resource_configured_threshold

The configured ERM threshold.

_resource_current_value

The current value reported by ERM.

_resource_dampen_time

The ERM dampen time, in nanoseconds.

_resource_direction

The ERM event direction. The event direction can be one of the following: up, down, or no change.

_resource_level

The ERM event level. The four event levels are normal, minor, major, and critical.

_resource_notify_data_flag

The ERM notify data flag.

_resource_owner_id

The ERM resource owner ID.

_resource_policy_id

The ERM policy ID.

_resource_policy_violation_flag

The ERM policy violation flag; either false or true.

_resource_time_sent

The ERM event time, in nanoseconds.

_resource_user_id

The ERM resource user ID.

SNMP Event Detector

_snmp_exit_event

A value of 0 indicates that this is not an exit event; a value of 1 indicates an exit event.

_snmp_oid

The SNMP object ID that caused the event to be published.

_snmp_oid_val

The SNMP object ID value when the event was published.

Syslog Event Detector

_syslog_msg

The syslog message that caused the event to be published.

Timer Event Detector

_timer_remain

The time available before the timer expires.

Note This environment variable is not available for the CRON timer.

_timer_time

The time at which the last event was triggered.

_timer_type

The type of timer.

Watchdog System Monitor (Cisco IOS) Event Detector

_ioswd_node

The slot number for the route processor (RP) reporting node.

_ioswd_num_subs

The number of subevents present.

All Watchdog System Monitor (Cisco IOS) Subevents

_ioswd_sub1_present
_ioswd_sub2_present

A value to indicate whether subevent 1 or subevent 2 is present. A value of 1 means that the subevent is present; a value of 0 means that the subevent is not present.

_ioswd_sub1_type
_ioswd_sub2_type

The event type, either cpu_util or mem_used.

Watchdog System Monitor (Cisco IOS) cpu_util Events

_ioswd_sub1_path
_ioswd_sub2_path

The process name of subevents.

_ioswd_sub1_period
_ioswd_sub2_period

The time period, in seconds and optional milliseconds, used for measurement in subevents.

_ioswd_sub1_pid
_ioswd_sub2_pid

A process identifier of subevents.

_ioswd_sub1_taskname
_ioswd_sub2_taskname

The task name of subevents.

_ioswd_sub1_value
_ioswd_sub2_value

The CPU utilization of subevents measured as a percentage.

Watchdog System Monitor (Cisco IOS) mem_used Events

_ioswd_sub1_diff
_ioswd_sub2_diff

A percentage value of the difference that triggered the event.

Note This variable is set only when the _ioswd_subx_is_percent variable contains a value of 1.

_ioswd_sub1_is_percent
_ioswd_sub2_is_percent

A number that identifies whether the value is a percentage. A value of 0 means that the value is not a percentage; a value of 1 means that the value is a percentage.

_ioswd_sub1_path
_ioswd_sub2_path

A process name of subevents.

_ioswd_sub1_pid
_ioswd_sub2_pid

A process identifier of subevents.

_ioswd_sub1_taskname
_ioswd_sub2_taskname

The task name of subevents.

_ioswd_sub1_value
_ioswd_sub2_value

The CPU utilization of subevents measured as a percentage.


Embedded Event Manager 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 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 this applet. If no event is specified, this applet is not considered registered and the applet is not displayed. When no action is associated with this 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 are uniquely identified using the label argument, which can be any string value. Actions are sorted in ascending alphanumeric key sequence using the label argument as the sort key and are run using this sequence.

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.

EEM Script

Scripts are defined off the networking device using an ASCII editor. The script is then copied to the networking device and registered with EEM. Tcl scripts are supported by EEM.

EEM allows you to write and implement your own policies using Tcl. Writing an EEM policy involves:

Selecting the event for which the policy is run

Defining the event detector options associated with logging and responding to the event

Choosing the actions to be followed when the event occurs

Cisco provides enhancements to Tcl in the form of keyword extensions that facilitate the development of EEM policies. The main categories of keywords identify the detected event, the subsequent action, utility information, counter values, and system information. For more details about the EEM event detectors and about creating EEM policies, see the Writing Embedded Event Manager Policies document.

Cisco includes a set of sample policies. You can copy the sample policies to a user directory and then modify the policies, or you can write your own policies. Tcl is currently the only Cisco-supported scripting language for policy creation. Tcl policies can be modified using a text editor such as Emacs. Policies must execute within a defined number of seconds of elapsed time and the time variable can be configured within a policy. The default is currently 20 seconds.

Table 3 describes the sample EEM policies.

Table 3 Sample EEM Policy Descriptions 

Name of Policy
Description

sl_intf_down.tcl

This policy runs when a configurable syslog message is logged. It will execute a configurable CLI command and e-mail the results.

tm_cli_cmd.tcl

This policy runs using a configurable CRON entry. It will execute a configurable CLI command and e-mail the results.

tm_crash_reporter.tcl

This policy runs 5 seconds after it is registered. If the policy is saved in the configuration, it will also run each time the router is reloaded. The policy will prompt for the reload reason. If the reload was due to a crash, the policy will search for the latest crashinfo file and send this information to a specified URL location.


The sample policies feature the timer and syslog event detectors. The timer event detector generates the following time-based events:

Watchdog

Countdown

Absolute time

CRON

Watchdog timer events occur when a timer counts down to zero and automatically rearm when they reach zero. Countdown timer events occur when a timer counts down to zero without being rearmed. An absolute timer event occurs when an absolute time of day is passed. CRON timer events occur when the CRON string specification matches the current time.

The syslog event detector screens syslog messages using Posix regular expressions. An event can be triggered after one or more occurrences of a message match. An additional modifier can be specified to require that the number of message match occurrences happen within a set period of time in order for an event to be triggered.

For more details about the sample policies, see the "EEM Event Detector Demo: Example" section.

How to Configure Embedded Event Manager 2.2

This section contains the following tasks:

Registering and Defining an Embedded Event Manager Applet

Registering and Defining an Embedded Event Manager Tcl Script

Registering and Defining an Embedded Event Manager Policy to Run Manually

Unregistering Embedded Event Manager Policies

Suspending Embedded Event Manager Policy Execution

Managing Embedded Event Manager Policies

Configuring and Tracking a Stub Object Using Embedded Event Manager

Displaying Embedded Event Manager History Data

Displaying Embedded Event Manager Registered Policies

Registering and Defining an Embedded Event Manager Applet

Perform this task to register an applet with Embedded Event Manager and to define the EEM applet using event and action commands. Only one event command is allowed in an EEM applet. Multiple action commands are permitted. If no event and no action commands are specified, the applet is removed when you exit configuration mode.

EEM Policies

EEM offers the ability to monitor events and take informational or corrective action when the monitored events occur or when a threshold is reached. 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 CLI configuration. A script is a form of policy that is written in Tcl.

SUMMARY STEPS

1. enable

2. configure terminal

3. event manager applet applet-name

4. event snmp oid oid-value get-type {exact | next} entry-op operator entry-val entry-value [exit-comb {or | and}] [exit-op operator] [exit-val exit-value] [exit-time exit-time-value] poll-interval poll-int-value

5. action label syslog [priority priority-level] msg msg-text

6. Repeat Step 5.

7. end

DETAILED STEPS

 
Command or Action
Purpose

Step 1 

enable

Example:

Router> enable

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2 

configure terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3 

event manager applet applet-name

Example:

Router(config)# event manager applet memory-fail

Registers the applet with the Embedded Event Manager (EEM) and enters applet configuration mode.

Step 4 

event snmp oid oid-value get-type {exact | next} entry-op operator entry-val entry-value [exit-comb {or | and}] [exit-op operator] [exit-val exit-value] [exit-time exit-time-value] poll-interval poll-int-value

Example:

Router(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

Specifies the event criteria that cause the EEM applet to run.

In this example, an EEM event is triggered when one of the fields specified by an SNMP object ID crosses a defined threshold.

Exit criteria are optional, and if not specified, event monitoring is reenabled immediately.

Step 5 

action label syslog [priority priority-level] msg msg-text

Example:

Router(config-applet)# action 1.0 syslog priority critical msg "Memory exhausted; current available memory is $_snmp_oid_val bytes"

Specifies the action to be taken when an EEM applet is triggered.

In this example, the action to be taken is to write a message to syslog.

The optional priority keyword specifies the priority level of the syslog messages. If selected, the priority-level argument must be defined.

The msg-text argument can be character text, an environment variable, or a combination of the two.

Step 6 

Repeat Step 5.

Example:

Router(config-applet)# action 2.0 force-switchover

(Optional) Repeat Step 5 to add other action CLI commands to the applet.

Step 7 

end

Example:

Router(config-applet)# end

Exits applet configuration mode and returns to privileged EXEC mode.

Troubleshooting Tips

Use the debug event manager command in privileged EXEC mode to troubleshoot EEM command operations. Use any debugging command with caution as the volume of generated output can slow or stop the router operations. We recommend that this command be used only under the supervision of a Cisco engineer.

Registering and Defining an Embedded Event Manager 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.

EEM Policies

EEM offers the ability to monitor events and take informational or corrective action when the monitored events occur or when a threshold is reached. 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 CLI configuration. A script is a form of policy that is written in Tcl.

Prerequisites

You must have a policy available that is written in the Tcl scripting language. Three sample policies—sl_intf_down.tcl, tm_cli_cmd.tcl, and tm_crash_reporter.tcl—are provided, 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 for all the required environment variables.

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 every second minute, every hour of every day.

Step 5 

Repeat Step 4 for all the required environment variables.

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.

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

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

Registering and Defining an Embedded Event Manager Policy to Run Manually

There are two ways to manually run an EEM policy. EEM usually schedules and runs policies on the basis of an event specification that is contained within the policy itself. The event none command allows EEM to identify an EEM policy that can either be run manually or be run when an EEM applet is triggered. To run the policy, use either the action policy command in applet configuration mode or the event manager run command in global configuration mode.

Perform this task to register an EEM policy to be run manually using the event manager run command. For an example of how to manually run a policy using the action policy command, see the "Embedded Event Manager Manual Policy Execution: Example" section.

SUMMARY STEPS

1. enable

2. configure terminal

3. event manager applet applet-name

4. event none policy-filename

5. exit

6. event manager run policy-filename

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 

configure terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3 

event manager applet applet-name

Example:

Router(config)# event manager applet manual-policy

Registers the applet with the Embedded Event Manager and enters applet configuration mode.

Step 4 

event none policy-filename

Example:

Router(config-applet)# event none manual-policy

Specifies that an EEM policy is to be registered with the EEM and can be run manually.

Step 5 

exit

Example:

Router(config-applet)# exit

Exits applet configuration mode and returns to global configuration mode.

Step 6 

event manager run policy-filename

Example:

Router(config)# event manager run manual-policy

Manually runs a registered EEM policy.

Step 7 

exit

Example:

Router(config)# exit

Exits global configuration mode and returns to privileged EXEC mode.

Unregistering Embedded Event Manager 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]

3. configure terminal

4. no event manager policy policy-filename [type {system | user}] [trap]

5. exit

6. Repeat Step 2 to ensure that the policy is 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]

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 is 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   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

Suspending Embedded Event Manager Policy Execution

Perform this task to immediately suspend the execution of all EEM policies. Suspending instead of unregistering policies 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]

3. configure terminal

4. event manager scheduler policy 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]

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 policy suspend

Example:

Router(config)# event manager scheduler policy suspend

Immediately suspends the execution of all EEM policies.

Step 5 

exit

Example:

Router(config)# exit

Exits global configuration mode and returns the router 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

Managing Embedded Event Manager Policies

Perform this task to define a location in the local file system containing an installed modular Cisco IOS image to run on all the nodes in a system, or on just one specified node.

SUMMARY STEPS

1. enable

2. show event manager directory user [library | policy]

3. configure terminal

4. event manager directory user [<