EasyManuals Logo

Cisco Catalyst 2960 Series User Manual

Cisco Catalyst 2960 Series
2288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1837 background imageLoading...
Page #1837 background image
In this example, conditional loops while, if and foreach are used to print data. Other action commands such
as action divide, action increment and action puts are used to define the actions to be performed when the
conditions are met.
event manager applet printdata
event none
action 100 set colors "red green blue"
action 101 set shapes "square triangle rectange"
action 102 set i "1"
action 103 while $i lt 6
action 104 divide $i 2
action 105 if $_remainder eq 1
action 106 foreach _iterator "$colors"
action 107 puts nonewline "$_iterator "
action 108 end
action 109 puts ""
action 110 else
action 111 foreach _iterator "$shapes"
action 112 puts nonewline "$_iterator "
action 113 end
action 114 puts ""
action 115 end
action 116 increment i
action 117 end
When the event manager applet ex is run, the following output is obtained:
event manager run printdata
red green blue
square triangle rectange
red green blue
square triangle rectange
red green blue
In this example, two environment variables poll_interface and max_rx_rate are set to F0/0 and 3 respectively.
Every 30 seconds there is a poll on an interface for rx rate. If the rx rate is greater than the threshold, a syslog
message is displayed.
This applet makes use of the foreach conditional statement to poll the interface, the if conditional block to
compare the value under RXPS with max_rx_rate that was set in the EEM environment variable.
event manager environment poll_interfaces F0/0
event manager environment max_rx_rate 3
ev man app check_rx_rate
ev timer watchdog name rx_timer time 30
action 100 foreach int $poll_interfaces
action 101 cli command "en"
action 102 cli command "show int $int summ | beg ------"
action 103 foreach line $_cli_result "\n"
action 105 regexp ".*[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+.*" $line
junk rxps
action 106 if $_regexp_result eq 1
action 107 if $rxps gt $max_rx_rate
action 108 syslog msg "Warning rx rate for $int is > than threshold. Current value is
$rxps
(threshold is $max_rx_rate)"
action 109 end
action 110 end
action 111 end
action 112 end
Example syslog message:
Oct 16 09:29:26.153: %HA_EM-6-LOG: c: Warning rx rate for F0/0 is > than threshold.
Current value is 4 (threshold is 3)
The output of show int F0/0 summ is of the format:
#show int f0/0 summ
*: interface is up
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1755
Configuration Examples for Writing Embedded Event Manager Policies Using Tcl

Table of Contents

Other manuals for Cisco Catalyst 2960 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Cisco Catalyst 2960 Series and is the answer not in the manual?

Cisco Catalyst 2960 Series Specifications

General IconGeneral
LayerLayer 2
Power over Ethernet (PoE)Available on some models
RAM128 MB
Flash Memory32 MB
MAC Address Table Size8000
Operating Temperature0°C to 45°C (32 to 113°F)
Ports24 or 48 x 10/100/1000

Related product manuals