this task, the value of a variable is set to 5. An if conditional block is then specified to check if the value of
the variable is less than 10. Provided the if conditional block is satisfied, an action command to output the
message ‘x is less than 10’ is specified.
Following the if conditional block, an else conditional block is specified. Provided the if conditional block is
not satisfied, an action command to output the message ‘x is greater than 10’ is specified.
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
event manager applet applet-name
4.
action label set variable-name variable-value
5.
action label if [stringop1] {eq | gt | ge | lt | le | ne} [stringop2]
6.
Add any action as required.
7.
action label else
8.
Add any action as required.
9.
end
DETAILED STEPS
PurposeCommand or Action
Enables privileged EXEC mode.enable
Step 1
Example:
Device> enable
•
Enter your password if prompted.
Enters global configuration mode.configure terminal
Example:
Device# configure terminal
Step 2
Registers the applet with the Embedded Event Manager
(EEM) and enters applet configuration mode.
event manager applet applet-name
Example:
Device(config)# event manager applet
ifcondition
Step 3
Sets an action for the event.
action label set variable-name variable-value
Step 4
Example:
Device(config-applet)# action 1.0 set x 5
•
In this example, the value of the variable x is set to 5.
Specifies an if conditional statement.
action label if [stringop1] {eq | gt | ge | lt | le | ne}
[stringop2]
Step 5
•
In this example, an if conditional statement to check
if the value of the variable is less than 10.
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1735
How to Write EEM Policies Using the Cisco IOS CLI