cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1332
Views
0
Helpful
6
Replies

change track status via TCL script

gsabharwal
Level 1
Level 1

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"

6 Replies 6

Joe Clarke
Cisco Employee
Cisco Employee

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?

I am running 12.4(15)T7 Advanced IP services on a Cisco 877.

Thanks

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?

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

Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: