cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1489
Views
0
Helpful
1
Replies

Missing variable in JClarks port shutdown script

Jason0352
Level 1
Level 1

I'm getting an error in Joe Clarks scripts that monitor up/down status of ports and shutdown those ports that have been "down" for a given amount time.

Whenever the script runs at midnight the policy fails:

Tcl policy execute failed:

tm_suspend_ports.tcl: can't read "port": no such variable

/////////////////////show logging///////////////////////////////////

Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: can't read "port": no such variable
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     while executing
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: "action_syslog msg "Shutting down port $port since it was last used on [clock format $suspend_ports($port)]""
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     invoked from within
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: "$slave eval $Contents"
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     (procedure "eval_script" line 7)
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     invoked from within
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: "eval_script slave $scriptname"
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     invoked from within
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: "if {$security_level == 1} {       #untrusted script
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:      interp create -safe slave
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:      interp share {} stdin slave
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:      interp share {} stdout slave
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: ..."
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl:     (file "tmpsys:/lib/tcl/base.tcl" line 50)
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: Tcl policy execute failed:
Jul 18 19:00:08.422: %HA_EM-6-LOG: tm_suspend_ports.tcl: can't read "port": no such variable

//////////////////////show registered///////////////////////////////////


No.  Class     Type    Event Type          Trap  Time Registered           Secu  Name
1    script    user    syslog              Off   Thu Jul 18 22:50:57 2013  2048  sl_suspend_ports.tcl
pattern {LINEPROTO-5-UPDOWN}
nice 0 queue-priority normal maxrun 600.000 scheduler rp_primary


2    script    user    timer cron          On    Thu Jul 18 22:51:06 2013  2048  tm_suspend_ports.tcl
cron entry {0 0 * * *}
nice 0 queue-priority normal maxrun 600.000 scheduler rp_primary


////////////////////show run//////////////////////////////////////////

event manager environment suspend_ports_days 1
event manager environment suspend_ports_config flash:/susp_ports.dat
event manager directory user policy "flash:/test"
event manager session cli username "netops"
event manager policy sl_suspend_ports.tcl
event manager policy tm_suspend_ports.tcl trap

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

It looks like this script was both modified from my original version and corrupted.  I fixed the modification typo and removed the corrupted bits.  This version should work.