Specifying If Else Conditional Blocks - 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

How to Write EEM Policies Using the Cisco IOS CLI
DETAILED STEPS
Command or Action
Step 1
enable
Example:
Device> enable
Step 2
configure terminal
Example:
Device# configure terminal
Step 3
event manager applet applet-name
Example:
Device(config)# event manager applet condition
Step 4
action label
Example:
Device(config-applet)#
Step 5
action label while string_op1 operator string_op2
Example:
Device(config-applet)# action 2 while $i lt 10
Step 6
Add any action as required.
Example:
Device(config-applet)#
is $i"
Step 7
action label
Example:
Device(config-applet)#

Specifying if else Conditional Blocks

To specify the beginning of an if conditional statement followed by an else conditional statement, perform
this task. The if or else conditional statements can be used in conjunction with each other or separately. In
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1734
set
action 1.0 set i 2
action 3 syslog msg "i
end
action 3 end
Purpose
Enables privileged EXEC mode.
• Enter your password if prompted.
Enters global configuration mode.
Registers the applet with the Embedded Event Manager
(EEM) and enters applet configuration mode.
Sets an action for the event.
• In this example, the value of the variable i is set to 2.
Specifies a loop of a conditional block.
• In this example, a loop is set to check if the value of
the variable i is less than 10.
Performs the action as indicated by the action command.
• In this example, the message 'i is $_i' is written to the
syslog.
Exits from the running action.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents