Defining a User Policy Using the CLI to Trigger a Python Script
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
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Cisco Nexus 5600 Series NX-OS System Management Configuration Guide, Release 7.x
250
Command or Action
switch# configure terminal
switch(config)# event manager applet
applet-name
switch(config-applet)# description
policy-description
switch(config-applet)# event
event-statement
switch(config-applet)# tag tag {and |
andnot | or} tag [and | andnot | or
{tag}] {happens occurs in seconds}
switch(config-applet)# action
number[.number2]
action-statementpython-filename
switch(config-applet)# show event
manager policy-state name [module
module-id]
Purpose
Enters global configuration mode.
Registers the applet with EEM and enters applet
configuration mode. The applet-name can be any
case-sensitive, alphanumeric string up to 29 characters.
(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.
Configures the event statement for the policy. See
Statement Configuration, on page
Repeat Step 4 for multiple event statements.
(Optional)
Correlates multiple events in the policy.
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
Repeat Step 6 for multiple action statements.
Displays information about the status of the configured
policy.
Configuring EEM
Event
242.
244.
OL-31641-01