Documente Academic
Documente Profesional
Documente Cultură
Bootcamp
Chapter 14
Catalyst 6500 Embedded Event Manager
© 2006 Cisco Systems, Inc. All rights reserved. CISCO PARTNER CONFIDENTIAL 1
Embedded Event Manager
Introduction
EEM is an IOS technology that runs on the Catalyst 6500’s control plane. It is a combination of
processes designed to monitor key system parameters such as CPU utilization, interface errors,
counters, SNMP and SYSLOG events, and act on specific events or thresholds/counters that are
exceeded…
The
Thefirst
firstrelease
releaseofofthe
theEEM
EEM
implementation
implementation(in (inIOS
IOSwith
with
Software
Software Modularity) is basedon
Modularity) is based on
V2.1.5
V2.1.5
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 2
Embedded Event Manager
How can it be used?
Generate custom
SYSLOG on scheduled Generate custom login
GOLD diagnostic run message based on
highlighting H/W issue.. user-id that logs in
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 3
Embedded Event Manager
Basic EEM Architecture
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 4
Embedded Event Manager
Detailed Architecture
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 5
Embedded Event Manager
Event Detectors
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 6
Embedded Event Manager
Event Detectors
Will allow IOS Applications or EEM Policies to publish application
specific events
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 9
Embedded Event Manager
Event Policy Director and Policies
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 10
Embedded Event Manager
EEM Policies
Policies can be defined either via the CLI (known as an applet) or via a TCL script that can be
loaded onto the local Compact Flash card - Policies can generate a variety of actions that
include executing a CLI command, sending an email, generating SYSLOG or SNMP Traps and
many more…
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 11
Embedded Event Manager
EEM Applet Policies
Configuration mode must be entered on the switch to both register the applet and create
the contents of the applet…
Note - the command “event manager applet” not only places you into the config mode
where you can enter applet commands, but also registers the “named” applet (in the case
above it registers applet “nov2005_rsvt” with the EEM policy director)…
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 12
Embedded Event Manager
EEM Applet Policies
Confirm the applet has been registered with the system then invoke an action to activate
the event…
C6500#show event manager policy registered
No. Class Type Event Type Trap Time Registered Name
…snip
11 applet system syslog Off Tue Oct 18 02:50:06 2005 nov2005_rsvt
pattern {count}
action 1.0 syslog msg "Hello R&S VT Attendees”
C6500#
C6500#
C6500#clear counters
Clear "show interface" counters on all interfaces [confirm]
C6500#
00:09:38: %CLEAR-5-COUNTERS: Clear counter on all interfaces by console
00:09:38: %HA_EM-6-LOG: nov2005_rsvt: Hello R&S VT Attendees
C6500#
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 13
Embedded Event Manager
EEM TCL Modes
The Cat6K supports TCL v8.3.4 which is the same TCLSH environment found in router IOS - a
range of environment variables can be set that are referenced within the TCL script…
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 14
EEM Tcl Policy Structure
§ Begin with EEM Event
Register keyword
§ Next is any input
Required
variables or required
environment variables
to control the script
§ Names space imports
Required
§ Entry criteria for the
policy
§ Body (logic of the
Required script)
§ Exit status
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 15
Example of Tcl Policy Structure
§ Registration command (Tcl
extension)
§ Tcl namespace (namespace
import)
::cisco::eem
This namespace includes all
Tcl commands closely
related to Embedded Event
Manager
::cisco::lib
This namespace includes
auxiliary library commands
that are not necessarily
specific to the Embedded
Event Manager
§ Body
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 16
Embedded Event Manager
EEM TCL Script Policy Example
In this example, we are going to setup the system with a user scripted TCL script - the
process for enabling this is shown below - create a directory to hold the scripts and
register this directory with EEM…
C6500#mkdir USER_TCL
Create directory filename [USER_TCL]? Create
Create User
User TCL
TCL Directory
Directory
Created dir disk0:USER_TCL
C6500#dir disk0:
Directory of disk0:/
1 drw- 1 Oct 18 2005 01:14:07 +00:00 USER_TCL
47843328 bytes total (47843327 bytes free)
C6500#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C6500(config)#event manager directory user policy disk0:/USER_TCL
C6500(config)#^Z Register
Register User
User TCL
TCL
C6500#show event man dir user policy Directory
Directory with
with EEM
EEM
disk0:/USER_TCL Policy
Policy Director
Director
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 17
Embedded Event Manager
EEM TCL Script Policy Example
Copy the TCL Script file onto the local CF Flash (into the registered script directory) and
then register the TCL script with the Event Manager…
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 18
Embedded Event Manager
EEM TCL Script Policy Example
Display the TCL script - Script is used to demonstrate how to save a switch configuration
to NVRAM when a system administrator exits configuration mode…
C6500#show event manager policy available detailed cfgSave.tcl
::cisco::eem::event_register_syslog occurs 1 pattern "\%SYS-5-CONFIG_I:
Configured" maxrun_sec 90
<…snip…>
if $u_cfgSave_on==1 {
action_syslog msg "Config save mode set, saving configuration to nvram"
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli $result
}
if [catch {cli_exec $cli(fd) "enable"} result] {
error $result $errorInfo
}
if [catch {cli_write $cli(fd) "copy run start"} result] {
error $result $errorInfo
}
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 19
Embedded Event Manager
EEM TCL Script Policy Example
if [catch {cli_read_pattern $cli(fd) "Destination filename"} result] {
error $result $errorInfo
}
if [catch {cli_write $cli(fd) "\n"} result] {
error $result $errorInfo
}
if [catch {cli_read_drain $cli(fd)} result] {
error $result $errorInfo
} else {
set cmd_output $result
action_syslog msg "copy command reponse - $cmd_output"
}
if [catch {cli_close $cli(fd) $cli(tty_id)} result] {
error $result $errorInfo
}
} else {
action_syslog msg "Config save mode not set, remember to save your
configuration to nvram"
}
action_syslog msg "done"
exit 0
C6500#
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 20
Embedded Event Manager
EEM TCL Script Policy Example
The script executes on exiting config mode - the results of this script can be seen as
follows…
C6500#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C6500(config)#interface f3/1
C6500(config-if)#description test
C6500(config-if)#^Z
C6500#
02:08:13: %SYS-5-CONFIG_I: Configured from console by consoleUpdateStringProc
should not be invoked for type
Hmmm
Hmmm -- itit didn’t
didn’t work
work -- what
what did
did we
we miss????
miss????
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 21
Embedded Event Manager
EEM TCL Script Policy Example
What we missed was setting an environment variable the the script parses before being able
to save the configuration to NVRAM - lets set the environment variable and try again…
C6500#conf t
Enter configuration commands, one per line. End with CNTL/Z.
C6500(config)#event manager environment u_cfgSave_on 1
C6500(config)#interface f3/1
C6500(config-if)#description test Variable
Variable set
set here!!!
here!!!
C6500(config-if)#^Z
C6500#
02:31:39: %SYS-5-CONFIG_I: Configured from console by consoleUpdateStringProc
should not be invoked for type cmdName
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 22
Embedded Event Manager
EEM in Action
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 23
Embedded Event Manager
EEM in Action
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 24
Embedded Event Manager
EEM in Action
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 25
Embedded Event Manager
EEM in Action
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 26
Embedded Event Manager
EEM in Action
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 27
EEM TCL Script
Force FWSM Context Failover
ACCESS DISTRIBUTION
CORE
OSPF
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 29
Embedded Event Manager
Scalability - The Scenario
How to determine the impact on the switch control plane from the one script being
invoked multiple times ?
Here is a sample script - EEM script runs to monitor for “Link Down” - upon
detection of event, generate custom SYSLOG message and insert a configuration
command for that port
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 30
Embedded Event Manager
Scalability - The Twist
The twist to this test is that the entire module is disabled resulting in the event being
triggered once for each of the ports on the module…
For a 48 port module, this script will be invoked 48 times - how does this impact the
switch control plane?
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 31
Embedded Event Manager
Scalability - The Result
The test showed that the script is invoked for each port in a sequential fashion (i.e.
runs for one port, finishes then is run for the next port and so on)…
30%
CPU 3%
Time
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 11 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 22 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 33 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
<.
<. .. >>
<.
<. .. >>
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 46
46 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 47
47 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
6d01h:
6d01h: % %HA_EM
HA_EM-- 6-
6- LOG:
LOG: // eem
eem_pol
_pol ii cy/
cy/ tt est
est tt cl
cl .. tt cl
cl :: II nt
nt er
er ff ace
ace Gi
Gi gabi
gabi tt Et
Et her
her net
net 3/
3/ 47
47 was
was
rr eset – conf i gur at i on updat
eset – conf i gur at i on updat ed ed
In this example the CPU peaked at ~30%. The actual CPU will be dependent on the
actions invoked by the EEM Script…
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 32
Tool Command Language (TCL)
Additional References
§ General language resources:
http://www.tcl.tk/
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 33
Cisco Beyond,
A Scripting Community for EEM
§ Cisco IOS
Embedded Event Manager
Extremely flexible and
powerful onboard, event
driven, scripting facility
§ Cisco Beyond
A place to share scripts,
upload, download, get
examples
§ Live on cisco.com
Pre-populated with over a
dozen scripts
More details:
http://cisco.com/go/eem
http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_book09186a008054dddf.html
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 34
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Partner Confidential 35