change track status via TCL script

Unanswered Question

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"

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Sun, 10/18/2009 - 19:14

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?

Joe Clarke Sun, 10/18/2009 - 19:30

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.

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?

Joe Clarke Sun, 10/18/2009 - 19:43

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

Actions

This Discussion