cli exit
incr i
}
This example shows how to define a user policy by using the CLI and invoking a Tcl script by using the action
statement once the event is triggered:
switch# configure terminal
switch(config)# event manager applet TCL
switch(config-applet)# description "Triggers TCL Script"
switch(config-applet)# event cli match "shutdown"
switch(config-applet)# action 1.0 cli local tclsh VLAN.tcl
switch(config-applet)# copy running-config startup-config
Defining a User Policy Using the CLI to Trigger a Python Script
Before You Begin
Copy the Python script which is triggered through an EEM policy to the bootflash of the switch.
Procedure
PurposeCommand or Action
Enters global configuration mode.switch# configure terminal
Step 1
Registers the applet with EEM and enters applet
configuration mode. The applet-name can be any
case-sensitive, alphanumeric string up to 29 characters.
switch(config)# event manager applet
applet-name
Step 2
(Optional)
Configures a descriptive string for the policy. The string
can be any alphanumeric string up to 80 characters.
Enclose the string in quotation marks.
switch(config-applet)# description
policy-description
Step 3
Configures the event statement for the policy. See Event
Statement Configuration, on page 242.
switch(config-applet)# event
event-statement
Step 4
Repeat Step 4 for multiple event statements.
(Optional)
Correlates multiple events in the policy.
switch(config-applet)# tag tag {and |
andnot | or} tag [and | andnot | or
{tag}] {happens occurs in seconds}
Step 5
The range for the occurs argument is from 1 to
4294967295. The range for the seconds argument is
from 0 to 4294967295 seconds.
Configures an action statement for the policy. See
Action Statement Configuration, on page 244.
switch(config-applet)# action
number[.number2]
action-statementpython-filename
Step 6
Repeat Step 6 for multiple action statements.
Displays information about the status of the configured
policy.
switch(config-applet)# show event
manager policy-state name [module
module-id]
Step 7
   Cisco Nexus 5600 Series NX-OS System Management Configuration Guide, Release 7.x
250 OL-31641-01   
Configuring EEM
Defining a User Policy Using the CLI to Trigger a Python Script