Need to create TCL script to send syslog message when difference in rxload on 2 serial interfaces is greater than a certain amount for 10 minutes

Unanswered Question
Jan 18th, 2010
User Badges:

I need to create a TCL script to check when the difference in the absolute value of the rxload on two interfaces, serial0/0/0:0 and serial0/0/1:0 is greater than 20 for more than 10 minutes. How would this be done?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Mon, 01/18/2010 - 12:57
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

I believe this policy will do what you want.  It requires a few environment variables to be set first:



# check_load_diff     : Integer value representing the maximum allowed

#                       rxload difference between the two interfaces.

#

# check_load_mins     : Number of minutes the rxload difference must be

#                       above check_load_diff before the syslog will be sent.

#

# check_load_int1     : First interface to check.

#

# check_load_int2     : Second interface to check.

#

# check_load_time     : Number of seconds between executions of this policy.


For example:


event manager environment check_load_diff 20

event manager environment check_load_mins 10

event manager environment check_load_int1 Serial0/0/0:0

event manager environment check_load_int2 Serial0/0/1:0

event manager environment check_load_time 60


Those values will cause the script to run every 60 seconds, and check for the conditions you described in this thread.

oschaul2 Wed, 01/20/2010 - 09:04
User Badges:

Thanks for your help. This worked great on a test router and one of our customer routers, but didn't work on the one customer that requested it. The one difference with their configuration is that they are using tacacs+. Would this make a difference? I wasn't able to get any information from the output interpreter.

Jan 20 10:49:32.987 CST: %HA_EM-6-LOG: tm_check_load.tcl: ..."

Jan 20 10:49:32.987 CST: %HA_EM-6-LOG: tm_check_load.tcl:     (file "system:/lib/tcl/base.tcl" line 50)

Jan 20 10:49:32.987 CST: %HA_EM-6-LOG: tm_check_load.tcl: Tcl policy execute failed: Failed to find rxload for Serial0/0/0:0 in 'Remote#'

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl: Failed to find rxload for Serial0/0/0:0 in 'Remote#'

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl:     while executing

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl: "get_curr_load $check_load_int1"

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl:     invoked from within

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl: "$slave eval $Contents"

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl:     (procedure "eval_script" line 7)

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl:     invoked from within

Jan 20 10:50:33.074 CST: %HA_EM-6-LOG: tm_check_load.tcl: "eval_script slave $scriptname"

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl:     invoked from within

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl: "if {$security_level == 1} {       #untrusted script

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl:      interp create -safe slave

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl:      interp share {} stdin slave

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl:      interp share {} stdout slave

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl: ..."

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl:     (file "system:/lib/tcl/base.tcl" line 50)

Jan 20 10:50:33.078 CST: %HA_EM-6-LOG: tm_check_load.tcl: Tcl policy execute failed: Failed to find rxload for Serial0/0/0:0 in 'Remote#'

Joe Clarke Wed, 01/20/2010 - 09:35
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

You need to add the following command if the device is doing command authorization:


event manager session cli username USER


Where USER is the username of a user authorized to run all of the CLI commands in the policy.

Actions

This Discussion

Related Content