10-18-2009 05:48 PM
I am trying to set the status of tracked object using action_track_set command available in EEM TCL. Relevant configuration from the router is below:
track 203 stub-object
default-state up
!
event manager environment _test_track 200
event manager environment _t_track 203
event manager directory user policy "flash:/tcl"
event manager directory user library "flash:/tcllib"
event manager policy test.tcl type user
The test.tcl script:
::cisco::eem::event_register_track $_test_track state down
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
action_track_set $_t_track state down
The script is invoked when the track 200 goes down, however I get the error below. Can somebody guide me what I might be doing wrong? Is the syntax of action_track_set not correct?
Oct 18 21:45:36: %TRACKING-5-STATE: 200 rtr 200 reachability Up->Down
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: Bad argument "203"
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: while executing
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: "action_track_set $_t_track state down"
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: invoked from within
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: "$slave eval $Contents"
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: (procedure "eval_script" line 7)
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: invoked from within
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: "eval_script slave $scriptname"
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: invoked from within
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: "if {$security_level == 1} { #untrusted script
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: interp create -safe slave
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: interp share {} stdin slave
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: interp share {} stdout slave
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: ..."
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: (file "tmpsys:/lib/tcl/base.tcl" line 50)
Oct 18 21:45:37: %HA_EM-6-LOG: test.tcl: Tcl policy execute failed: Bad argument "203"
10-18-2009 07:14 PM
Your policy generally looks okay. You should not be using variables that being with '_', though. That character is reserved for Cisco variables.
I am unable to reproduce your problem. What version of code are you running?
10-18-2009 07:22 PM
I am running 12.4(15)T7 Advanced IP services on a Cisco 877.
Thanks
10-18-2009 07:30 PM
This code is broken. There doesn't appear to be a bug associated with the fix, but I can confirm it is fixed in 12.4(20)T and higher.
10-18-2009 07:39 PM
Thanks for the confirmation. Will have to look at using EEM applets to set the status and hope that at least that works. Off the top of my head, I am planning to send a syslog message via the TCL script that will be trigger an applet.
event manager applet SLA_TRACK
event syslog pattern ".*link down.*"
action 1.0 cli command "enable"
action 2.0 track set 203 state down
Do you know of any other way?
10-18-2009 07:43 PM
This will not work. Syslogs sent by EEM cannot be intercepted by EEM. You can use a none event detector, and trigger that with the action_policy:
action_policy SLA_TRACK
event manager applet SLA_TRACK
event none
action 1.0 track set 203 state down
10-18-2009 07:46 PM
Thanks
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide