Embedded Event Manager Environment Variables - Cisco Catalyst 2960 series Configuration Manual

Consolidated platform configuration guide, ios release 15.2(4)e
Hide thumbs Also See for Catalyst 2960 series:
Table of Contents

Advertisement

Information About Embedded Event Manager
EEM action CLI commands contain an EEM action label that is a unique identifier that can be any string
value. Actions are sorted and run in ascending alphanumeric (lexicographical) key sequence using the label
as the sort key. If you are using numbers as labels be aware that alphanumerical sorting will sort 10.0 after
1.0, but before 2.0, and in this situation we recommend that you use numbers such as 01.0, 02.0, and so on,
or use an initial letter followed by numbers.

Embedded Event Manager Environment Variables

EEM allows environment variables to be used in EEM policies. 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 built-in (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 at policy exit for policies triggered from synchronous
events.
Cisco-defined environment variables (see the table below) and Cisco system-defined environment variables
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 Tcl 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.
Cisco built-in environment variables are a subset of the Cisco-defined environment variables and the built-in
variables are available to EEM applets only. The built-in variables can be read-only or can be read and write,
and these variables may apply to one specific event detector or to all event detectors. For more details and a
table listing the Cisco system-defined variables, see the ""Writing Embedded Event Manager Policies Using
the Cisco IOS CLI" module.
Note
Cisco-defined environment variables begin with an underscore character (_). We strongly recommend
that customers avoid the same naming convention to prevent naming conflicts.
The table below describes the Cisco-defined variables used in the sample EEM policies. Some of the
environment variables do not have to be specified for the corresponding sample policy to run and these are
marked as optional.
Table 157: Cisco-Defined Environmental Variables and Examples
Environment Variable
_config_cmd1
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1676
Description
The first configuration command
that is executed.
Example
interface Ethernet1/0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents