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.
Cisco-defined environment variables begin with an underscore character (_). We strongly recommend
that customers avoid the same naming convention to prevent naming conflicts.
Note
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
Example
Description
Environment Variable
interface Ethernet1/0
The first configuration command
that is executed.
_config_cmd1
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1676
Information About Embedded Event Manager
Summary of Contents for Catalyst 2960 Series
Page 96: ......
Page 196: ......
Page 250: ......
Page 292: ......
Page 488: ......
Page 589: ...P A R T VI Cisco Flexible NetFlow Configuring NetFlow Lite page 509 ...
Page 590: ......
Page 619: ...P A R T VII QoS Configuring QoS page 539 Configuring Auto QoS page 645 ...
Page 620: ......
Page 750: ......
Page 1604: ......
Page 1740: ......
Page 2105: ...P A R T XII Configuring Cisco IOS IP SLAs Configuring Cisco IP SLAs page 2025 ...
Page 2106: ......
Page 2118: ......
Page 2164: ......