Embedded Event Manager Commands

This module describes the commands that are used to set the Embedded Event Manager (EEM) operational attributes and monitor EEM operations.


Note


All commands applicable for the Cisco NCS 5500 Series Router are also supported on the Cisco NCS 540 Series Router that is introduced from Cisco IOS XR Release 6.3.2. References to earlier releases in Command History tables apply to only the Cisco NCS 5500 Series Router.



Note


  • Starting with Cisco IOS XR Release 6.6.25, all commands applicable for the Cisco NCS 5500 Series Router are also supported on the Cisco NCS 560 Series Routers.

  • Starting with Cisco IOS XR Release 6.3.2, all commands applicable for the Cisco NCS 5500 Series Router are also supported on the Cisco NCS 540 Series Router.

  • References to releases before Cisco IOS XR Release 6.3.2 apply to only the Cisco NCS 5500 Series Router.

  • Cisco IOS XR Software Release 7.0.1 specific updates are not applicable for the following variants of Cisco NCS 540 Series Routers:

    • N540-28Z4C-SYS-A

    • N540-28Z4C-SYS-D

    • N540X-16Z4G8Q2C-A

    • N540X-16Z4G8Q2C-D

    • N540X-16Z8Q2C-D

    • N540-12Z20G-SYS-A

    • N540-12Z20G-SYS-D

    • N540X-12Z16G-SYS-A

    • N540X-12Z16G-SYS-D


The Cisco IOS XR software EEM functions as the central clearing house for the events detected by any portion of Cisco IOS XR software High Availability Services. The EEM is responsible for fault detection, fault recovery, and process the reliability statistics in a system. The EEM is policy driven and enables you to configure the high-availability monitoring features of the system to fit your needs.

The EEM monitors the reliability rates achieved by each process in the system. You can use these metrics during testing to identify the components that do not meet their reliability or availability goals, which in turn enables you to take corrective action.

For detailed information about the EEM concepts, configuration tasks, and examples, see the Configuring and Managing Embedded Event Manager Policies module in System Monitoring Configuration Guide for Cisco NCS 5500 Series RoutersSystem Monitoring Configuration Guide for Cisco NCS 540 Series RoutersSystem Monitoring Configuration Guide for Cisco NCS 560 Series Routers.

event manager directory user

To specify a directory name for storing user library files or user-defined Embedded Event Manager (EEM) policies, use the event manager directory user command in XR Config mode. To disable the use of a directory for storing user library files or user-defined EEM policies, use the no form of this command.

event manager directory user {library path | policy path}

no event manager directory user {library path | policy path}

Syntax Description

library

Specifies a directory name for storing user library files.

path

Absolute pathname to the user directory on the flash device.

policy

Specifies a directory name for storing user-defined EEM policies.

Command Default

No directory name is specified for storing user library files or user-defined EEM policies.

Command Modes

XR Config mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Cisco IOS XR software supports only the policy files that are created by using the Tool Command Language (TCL) scripting language. The TCL software is provided in the Cisco IOS XR software image when the EEM is installed on the network device. Files with the .tcl extension can be EEM policies, TCL library files, or a special TCL library index file named tclindex. The tclindex file contains a list of user function names and library files that contain the user functions (procedures). The EEM searches the user library directory when the TCL starts to process the tclindex file.

User Library

A user library directory is needed to store user library files associated with authoring EEM policies. If you do not plan to write EEM policies, you do not have to create a user library directory.

To create user library directory before identifying it to the EEM, use the mkdir command in XR EXEC mode. After creating the user library directory, use the copy command to copy the .tcl library files into the user library directory.

User Policy

A user policy directory is essential to store the user-defined policy files. If you do not plan to write EEM policies, you do not have to create a user policy directory. The EEM searches the user policy directory when you enter the event manager policy policy-name user command.

To create a user policy directory before identifying it to the EEM, use the mkdir command in XR EXEC mode. After creating the user policy directory, use the copy command to copy the policy files into the user policy directory.

Task ID

Task ID

Operations

eem

read, write

Examples

This example shows how to set the pathname for a user library directory to /usr/lib/tcl on disk0:


RP/0/RP0/CPU0:router(config)# event manager directory user library disk0:/usr/lib/tcl

This example shows how to set the location of the EEM user policy directory to /usr/fm_policies on disk0:


RP/0/RP0/CPU0:router(config)# event manager directory user policy disk0:/usr/fm_policies

event manager environment

To set an Embedded Event Manager (EEM) environment variable, use the event manager environment command in XR Config mode. To remove the configuration, use the no form of this command.

event manager environment var-name [var-value]

no event manager environment var-name

Syntax Description

var-name

Name assigned to the EEM environment configuration variable.

var-value

(Optional) Series of characters, including embedded spaces, to be placed in the environment variable var-name .

Command Default

None

Command Modes

XR Config mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Environment variables are available to EEM policies when you set the variables using the event manager environment command. They become unavailable when you remove them with the no form of this command.

By convention, the names of all the environment variables defined by Cisco begin with an underscore character (_) to set them apart, for example, _show_cmd.

Spaces can be used in the var-value argument. This command interprets everything after the var-name argument uptil the end of the line in order to be a part of the var-value argument.

Use the event manager environment command to display the name and value of all EEM environment variables before and after they have been set using the event manager environment command.

Task ID

Task ID

Operations

eem

read, write

Examples

This example shows how to define a set of EEM environment variables:


RP/0/RP0/CPU0:router(config)# event manager environment _cron_entry 0-59/2 0-23/1 * * 0-7
RP/0/RP0/CPU0:router(config)# event manager environment _show_cmd show eem manager policy registered
RP/0/RP0/CPU0:router(config)# event manager environment _email_server alpha@cisco.com 
RP/0/RP0/CPU0:router(config)# event manager environment _email_from beta@cisco.com
RP/0/RP0/CPU0:router(config)# event manager environment _email_to beta@cisco.com
RP/0/RP0/CPU0:router(config)# event manager environment _email_cc

event manager policy

To register an Embedded Event Manager (EEM) policy with the EEM, use the event manager policy command in XR Config mode. To unregister an EEM policy from the EEM, use the no form of this command.

event manager policy policy-name username username [persist-time [seconds | infinite] | type {system | user}]

no event manager policy policy-name [username username]

Syntax Description

policy-name

Name of the policy file.

username username

Specifies the username used to run the script. This name can be different from that of the user who is currently logged in, but the registering user must have permissions that are a superset of the username that runs the script. Otherwise, the script is not registered, and the command is rejected.

In addition, the username that runs the script must have access privileges to the commands issued by the EEM policy being registered.

persist-time [seconds | infinite]

(Optional) The length of the username authentication validity, in seconds. The default time is 3600 seconds (1 hour). The seconds range is 0 to 4294967294. Enter 0 to stop the username authentication from being cached. Enter the infinite keyword to stop the username from being marked as invalid.

type

(Optional) Specifies the type of policy.

system

(Optional) Registers a system policy defined by Cisco.

user

(Optional) Registers a user-defined policy.

Command Default

The default persist time is 3600 seconds (1 hour).

Command Modes

XR Config mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

The EEM schedules and runs policies on the basis of an event specification that is contained within the policy itself. When the event manager policy command is invoked, the EEM examines the policy and registers it to be run when the specified event occurs. An EEM script is available to be scheduled by the EEM until the no form of this command is entered.


Note


AAA authorization (such as the aaa authorization command with the eventmanager and default keywords) must be configured before the EEM policies can be registered. The eventmanager and default keywords must be configured for policy registration. See the Configuring AAA Services module of System Security Configuration Guide for Cisco NCS 5500 Series RoutersSystem Security Configuration Guide for Cisco NCS 540 Series RoutersSystem Security Configuration Guide for more information on AAA authorization configuration.


Username

Enter the username that should execute the script with the username username keyword and argument. This name can be different from the user who is currently logged in, but the registering user must have permissions that are a superset of the username that runs the script. Otherwise, the script will not be registered, and the command will be rejected. In addition, the username that runs the script must have access privileges to the commands issued by the EEM policy being registered.

Persist-time

When a script is first registered, the configured username for the script is authenticated. If authentication fails, or if the AAA server is down, the script registration fails.

After the script is registered, the username is authenticated each time a script is run.

If the AAA server is down, the username authentication can be read from memory. The persist-time determines the number of seconds this username authentication is held in memory.

  • If the AAA server is down and the persist-time has not expired, the username is authenticated from memory, and the script runs.
  • If the AAA server is down, and the persist-time has expired, user authentication fails, and the script does not run.

Note


EEM attempts to contact the AAA server and refresh the username reauthenticate whenever the configured refresh-time expires. See the event manager refresh-time command for more information.


These values can be used for the persist-time:

  • The default persist-time is 3600 seconds (1 hour). Enter the event manager policy command without the persist-time keyword to set the persist-time to 1 hour.
  • Enter zero to stop the username authentication from being cached. If the AAA server is down, the username is not authenticated and the script does not run.
  • Enter infinite to stop the username from being marked as invalid. The username authentication held in the cache will not expire. If the AAA server is down, the username is authenticated from the cache.

Type

If you enter the event manager policy command without specifying the type keyword, the EEM first tries to locate the specified policy file in the system policy directory. If the EEM finds the file in the system policy directory, it registers the policy as a system policy. If the EEM does not find the specified policy file in the system policy directory, it looks in the user policy directory. If the EEM locates the specified file in the user policy directory, it registers the policy file as a user policy. If the EEM finds policy files with the same name in both the system policy directory and the user policy directory, the policy file in the system policy directory takes precedence, and the policy file is registered as a system policy.

Task ID

Task ID

Operations

eem

read, write

Examples

This example shows how to register a user-defined policy named cron.tcl located in the user policy directory:


RP/0/RP0/CPU0:router(config)# event manager policy cron.tcl username joe

event manager refresh-time

To define the time between user authentication refreshes in Embedded Event Manager (EEM), use the event manager refresh-time command in XR Config mode. To restore the system to its default condition, use the no form of this command.

event manager refresh-time seconds

no event manager refresh-time seconds

Syntax Description

seconds

Number of seconds between user authentication refreshes, in seconds. Range is 10 to 4294967295.

Command Default

The default refresh time is 1800 seconds (30 minutes).

Command Modes

XR Config mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

EEM attempts to contact the AAA server and refresh the username reauthentication whenever the configured refresh-time expires.

Task ID

Task ID

Operations

eem

read, write

Examples

This example shows how to set the refresh time:


RP/0/RP0/CPU0:router(config)# event manager refresh-time 1900

event manager run

To manually run an Embedded Event Manager (EEM) policy, use the event manager run command in XR EXEC mode.

event manager run policy [argument [. . . [argument15] ]]

Syntax Description

policy

Name of the policy file.

[argument[...[argument15]]]

Argument that you want to pass to the policy. The maximum number of arguments is 15.

Command Default

No registered EEM policies are run.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

EEM usually schedules and runs policies on the basis of an event specification that is contained within the policy itself. The event manager run command allows policies to be run manually.

You can query the arguments in the policy file by using the TCL command event_reqinfo , as shown in this example:

 array set arr_einfo [event_reqinfo] set argc $arr_einfo(argc) set arg1
            $arr_einfo(arg1) 

Use the event manager run command to register the policy before using the event manager run command to run the policy. The policy can be registered with none as the event type.

Task ID

Task ID

Operations

eem

read

Examples

This example of the event manager run command shows how to manually run an EEM policy named policy-manual.tcl:

 
RP/0/RP0/CPU0:router# event manager run policy-manual.tcl parameter1 parameter2 parameter3 
RP/0/RP0/CPU0:Sep 20 10:26:31.169 : user-plocy.tcl[65724]: The reqinfo of arg2 is parameter2. 
RP/0/RP0/CPU0:Sep 20 10:26:31.170 : user-plocy.tcl[65724]: The reqinfo of argc is 3. 
RP/0/RP0/CPU0:Sep 20 10:26:31.171 : user-plocy.tcl[65724]: The reqinfo of arg3 is parameter3. 
RP/0/RP0/CPU0:Sep 20 10:26:31.172 : user-plocy.tcl[65724]: The reqinfo of event_type_string is none. 
RP/0/RP0/CPU0:Sep 20 10:26:31.172 : user-plocy.tcl[65724]: The reqinfo of event_pub_sec is 1190283990. 
RP/0/RP0/CPU0:Sep 20 10:26:31.173 : user-plocy.tcl[65724]: The reqinfo of event_pub_time is 1190283990. 
RP/0/RP0/CPU0:Sep 20 10:26:31.173 : user-plocy.tcl[65724]: The reqinfo of event_id is 3. 
RP/0/RP0/CPU0:Sep 20 10:26:31.174 : user-plocy.tcl[65724]: The reqinfo of arg1 is parameter1. 
RP/0/RP0/CPU0:Sep 20 10:26:31.175 : user-plocy.tcl[65724]: The reqinfo of event_type is 16. 
RP/0/RP0/CPU0:Sep 20 10:26:31.175 : user-plocy.tcl[65724]: The reqinfo of event_pub_msec is 830 

event manager scheduler suspend

To suspend the Embedded Event Manager (EEM) policy scheduling execution immediately, use the event manager scheduler suspend command in XR Config mode. To restore a system to its default condition, use the no form of this command.

event manager scheduler suspend

no event manager scheduler suspend

Syntax Description

This command has no keywords or arguments.

Command Default

Policy scheduling is active by default.

Command Modes

XR Config mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Use the event manager scheduler suspend command to suspend all the policy scheduling requests, and do not perform scheduling until you enter the no form of this command. The no form of this command resumes policy scheduling and runs pending policies, if any.

It is recommended that you suspend policy execution immediately instead of unregistering policies one by one, for the following reasons:

  • Security—If you suspect that the security of your system has been compromised.
  • Performance—If you want to suspend policy execution temporarily to make more CPU cycles available for other functions.

Task ID

Task ID

Operations

eem

read, write

Examples

This example shows how to disable policy scheduling:


RP/0/RP0/CPU0:router(config)# event manager scheduler suspend

This example shows how to enable policy scheduling:


RP/0/RP0/CPU0:router(config)# no event manager scheduler suspend

show event manager directory user

To display the current value of the EEM user library files or user-defined Embedded Event Manager (EEM) policies, use the show event manager directory user command in XR EXEC mode.

show event manager directory user {library | policy}

Syntax Description

library

Specifies the user library files.

policy

Specifies the user-defined EEM policies.

Command Default

None

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Use the show event manager directory user command to display the current value of the EEM user library or policy directory.

Task ID

Task ID

Operations

eem

read

Examples

This is a sample output of the show event manager directory user command:


RP/0/RP0/CPU0:router# show event manager directory user library
disk0:/fm_user_lib_dir

RP/0/RP0/CPU0:router# show event manager directory user policy 
disk0:/fm_user_pol_dir

show event manager environment

To display the names and values of the Embedded Event Manager (EEM) environment variables, use the show event manager environment command in XR EXEC mode.

show event manager environment [all | environment-name]

Syntax Description

all

(Optional) Specifies all the environment variables.

environment-name

(Optional) Environment variable for which data is displayed.

Command Default

All environment variables are displayed.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Use the show event manager environment command to display the names and values of the EEM environment variables.

Task ID

Task ID

Operations

eem

read

Examples

This is a sample output of the show event manager environment command:


RP/0/RP0/CPU0:router# show event manager environment

No.  Name                          Value
1    _email_cc                     
2    _email_to                     mosnerd@cisco.com
3    _show_cmd                     show event manager policy registered
4    _cron_entry                   0-59/2 0-23/1 * * 0-7
5    _email_from                   mosnerd@cisco.com
6    _email_server                 zeta@cisco.com

This table describes the significant fields in the display.

Table 1. show event manager environment Field Descriptions

Field

Description

No.

Number of the EEM environment variable.

Name

Name of the EEM environment variable.

Value

Value of the EEM environment variable.

show event manager policy available

To display Embedded Event Manager (EEM) policies that are available to be registered, use the show event manager policy available command in XR EXEC mode.

show event manager policy available [system | user]

Syntax Description

system

(Optional) Displays all the available system policies.

user

(Optional) Displays all the available user policies.

Command Default

If this command is invoked with no optional keywords, it displays information for all available system and user policies.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

Use the show event manager policy available command to find out what policies are available to be registered just prior to using the event manager policy command to register policies.

This command is also useful if you forget the exact name of a policy that is required for the event manager policy command.

Task ID

Task ID

Operations

eem

read

Examples

This is a sample output of the show event manager policy available command:


RP/0/RP0/CPU0:router# show event manager policy available

No.  Type    Time Created                  Name
1    system  Tue Jan 12 09:41:32 2004      pr_sample_cdp_abort.tcl
2    system  Tue Jan 12 09:41:32 2004      pr_sample_cdp_revert.tcl
3    system  Tue Jan 12 09:41:32 2004      sl_sample_intf_down.tcl
4    system  Tue Jan 12 09:41:32 2004      tm_sample_cli_cmd.tcl
5    system  Tue Jan 12 09:41:32 2004      tm_sample_crash_hist.tcl
6    system  Tue Jan 12 09:41:32 2004      wd_sample_proc_mem_used.tcl
7    system  Tue Jan 12 09:41:32 2004      wd_sample_sys_mem_used.tcl

This table describes the significant fields shown in the display.

Table 2. show event manager policy available Field Descriptions

Field

Description

No.

Number of the policy.

Type

Type of policy.

Time Created

Time the policy was created.

Name

Name of the policy.

show event manager policy registered

To display the Embedded Event Manager (EEM) policies that are already registered, use the show event manager policy registered command in XR EXEC mode.

show event manager policy registered [event-type type] [system | user] [time-ordered | name-ordered]

Syntax Description

event-type type

(Optional) Displays the registered policies for a specific event type, where the valid type options are as follows:

  • application —Application event type
  • cli —CLI event type
  • config —Conf event type
  • counter —Counter event type
  • hardware —Hardware event type
  • none —None event type
  • oir —Online insertion and removal (OIR) event type
  • process-abort —Event type for abnormal termination of process
  • process-start —Process start event type
  • process-term —Process termination event type
  • process-user-restart —Process user restart event type
  • process-user-shutdown —Process user shutdown event type
  • snmp —SNMP event type
  • snmp-proxy —SNMP PROXY event type
  • statistics —Statistics event type
  • syslog —Syslog event type
  • timer-absolute —Absolute timer event type
  • timer-countdown —Countdown timer event type
  • timer-cron —Clock daemon (cron) timer event type
  • timer-watchdog —Watchdog timer event type
  • track —Track event type
  • wdsysmon —Watchdog system monitor event type
system

(Optional) Displays the registered system policies.

user

(Optional) Displays the registered user policies.

time-ordered

(Optional) Displays the policies according to registration time.

name-ordered

(Optional) Displays the policies in alphabetical order according to policy name.

Command Default

If this command is invoked with no optional keywords or arguments, it displays the registered EEM policies for all the event types. The policies are displayed according to the registration time.

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

The output of the show event manager policy registered command is most beneficial if you are writing and monitoring the EEM policies. The output displays registered policy information in two parts. The first line in each policy description lists the index number assigned to the policy, policy type (system or user), type of event registered, time at which the policy was registered, and name of the policy file. The remaining lines of each policy description display information about the registered event and how the event is to be handled, and come directly from the Tool Command Language (TCL) command arguments that make up the policy file.

Registered policy information is documented in the Cisco publication Writing Embedded Event Manager Policies Using Tcl .

Task ID

Task ID

Operations

eem

read

Examples

This is a sample output of the show event manager policy registered command:


RP/0/RP0/CPU0:router# show event manager policy registered

No.       Type    Event Type          Time Registered               Name
1         system  proc abort          Wed Jan 16 23:44:56 2004      test1.tcl
 version 00.00.0000 instance 1 path {cdp}
 priority normal maxrun_sec 20 maxrun_nsec 0
2         system  timer cron          Wed Jan 16 23:44:58 2004      test2.tcl
 name {crontimer1}
 priority normal maxrun_sec 20 maxrun_nsec 0
3         system  proc abort          Wed Jan 16 23:45:02 2004      test3.tcl
 path {cdp}
 priority normal maxrun_sec 20 maxrun_nsec 0
4         system  syslog              Wed Jan 16 23:45:41 2004      test4.tcl
 occurs 1 pattern {test_pattern}
 priority normal maxrun_sec 90 maxrun_nsec 0
5         system  timer cron          Wed Jan 16 23:45:12 2004      test5.tcl
 name {crontimer2}
 priority normal maxrun_sec 30 maxrun_nsec 0
6         system  wdsysmon            Wed Jan 16 23:45:15 2004      test6.tcl
 timewin_sec 120 timewin_nsec 0 sub1 mem_tot_used {node {localhost} op gt
 val 23000}
 priority normal maxrun_sec 40 maxrun_nsec 0
7         system  wdsysmon            Wed Jan 16 23:45:19 2004      test7.tcl
 timewin_sec 120 timewin_nsec 0 sub1 mem_proc {node {localhost} procname
 {wdsysmon} op gt val 80 is_percent FALSE}
 priority normal maxrun_sec 40 maxrun_nsec 0

This table describes the significant fields displayed in the example.

Table 3. show event manager policy registered Field Descriptions

Field

Description

No.

Number of the policy.

Type

Type of policy.

Event Type

Type of the EEM event for which the policy is registered.

Time Registered

Time at which the policy was registered.

Name

Name of the policy.

show event manager refresh-time

To display the time between the user authentication refreshes in the Embedded Event Manager (EEM), use the show event manager refresh-time command in XR EXEC mode.

show event manager refresh-time

Syntax Description

This command has no keywords or arguments.

Command Default

None

Command Modes

XR EXEC mode

Command History

Release

Modification

Release 6.0

This command was introduced.

Usage Guidelines

The output of the show event manager refresh-time command is the refresh time, in seconds.

Task ID

Task ID

Operations

eem

read

Examples

This is a sample output of the show event manager refresh-time command:


RP/0/RP0/CPU0:router# show event manager refresh-time
Output:
1800 seconds