Defining a User Policy Using the CLI to Trigger a Tcl Script
Before You Begin
Copy the Tcl 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-statementtcl-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
Saves the change persistently through reboots and
restarts by copying the running configuration to the
startup configuration.
switch(config-applet)# copy
running-config startup-config
Step 8
Sample Tcl file (Vlan.tcl). Copy this file to the bootflash. Running the file creates 99 VLANs and names
them.
set i 1
while {$i<100} {
cli configure terminal
cli vlan $i
cli name VLAN$i
cli no shutdown
Cisco Nexus 5600 Series NX-OS System Management Configuration Guide, Release 7.x
OL-31641-01 249
Configuring EEM
Defining a User Policy Using the CLI to Trigger a Tcl Script