Page tree
Skip to end of metadata
Go to start of metadata

Similar to on a Windows or Linux computer, environment variables can be configured within Cisco IOS Embedded Event Manager (EEM) and used within EEM applets. This can benefit network administrators by needing to define constants only once, such as the IP address of an SMTP server to be used for email alerting, instead of needing to define this multiple times across multiple applets.

The environment variables presently configured on a device can be viewed from a privileged EXEC session with the command show event manager environment all.

Router#show event manager environment all
No.  Name                          Value
1    _variable_name                _variable_value
Router#

To create a new environment variable, enter global configuration mode and use command event manager environment <name> <value>.

Tip

There are a number of built-in environment variables pre-existing within EEM. Refer to Cisco's documentation for a list of built-in variables for your device and IOS version and take care to choose a unique variable name.

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#event manager environment _variable_2_name _variable_2_value
Router(config)#exit
Router#

If you once again issue the command show event manager environment all you will see your newly-created variable listed.

Router#show event manager environment all
No.  Name                          Value
1    _variable_name                _variable_value
2    _variable_2_name              _variable_2_value
Router#