Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

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

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?

Everyone's tags (6)
4 REPLIES
Cisco Employee

Re: Need to create TCL script to send syslog message when differ

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.

New Member

Re: Need to create TCL script to send syslog message when differ

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#'

Cisco Employee

Re: Need to create TCL script to send syslog message when differ

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.

New Member

Re: Need to create TCL script to send syslog message when differ

Thanks, that worked.

1561
Views
0
Helpful
4
Replies