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

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

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Tcl Script Check Please

Hello Community,

I have been evaluating the attached script. It appeared to work on my GNS3 lab, but when I apply the script to our production equipment it won't work.

I tested it by changing one of the environment variables to:

event manager environment interface_reset_threshold 2


event manager environment interface_health_period 10

However, when the interface reset increment to 2 over 10 seconds nothing no email was sent.

I know email is working because I used the sendmail.tcl script.

Can someone please check out the script and let me know if they're able to get it to work?

I've uploaded the script to the following device:

MX-C3750-FL0-S#show version

Cisco IOS Software, C3750E Software (C3750E-UNIVERSALK9-M), Version 12.2(55)SE5, RELEASE SOFTWARE (fc1)

Technical Support:

Copyright (c) 1986-2012 by Cisco Systems, Inc.

Compiled Thu 09-Feb-12 18:14 by prod_rel_team

Image text-base: 0x00003000, data-base: 0x02800000

ROM: Bootstrap program is C3750E boot loader

BOOTLDR: C3750E Boot Loader (C3750X-HBOOT-M) Version 12.2(53r)SE2, RELEASE SOFTWARE (fc1)

cisco WS-C3750X-48P (PowerPC405) processor (revision K0) with 262144K bytes of memory.

Processor board ID FDO1703H2F9

Last reset from power-on

3 Virtual Ethernet interfaces

1 FastEthernet interface

208 Gigabit Ethernet interfaces

8 Ten Gigabit Ethernet interfaces

The password-recovery mechanism is enabled.




Accepted Solutions
Cisco Employee

Re: Tcl Script Check Please

New Member

Tcl Script Check Please


I'm thinking that it won't work on 3750 because the format of the interfaces are


But not sure

Cisco Employee

Tcl Script Check Please

I see no reason why this shouldn't work with 3750-style interface names.  However, it only looks at those interfaces with IP addresses on them.  If you care about non-IP ports, then you likely want to change the command on line 165 to:

sh ip int brief | exc Interface|down|\[0-9\]*/\[0-9\]*\\.\[0-9\]*

New Member

Re: Tcl Script Check Please

Hi Joseph,

Thanks for responding.

All of the ports on the 3750 are switchports, apart from our management ports.

I made the change as you suggested, however I'm now getting the following error when I try to register the policy:

MX-C3750-FL0-S(config)#event manage p composite_device_health.tcl

EEM Register event failed:extra characters after close-quote

    while compiling

""} result] {

    error $result $errorInfo


set interface $result

#--- Fetch interface counter information

for { set i 0 } { $i < [expr [llength $i..."

Any thoughts

New Member

Re: Tcl Script Check Please

Hi Joseph,

I realised that I was being a numpty and fixed the problem.

However, I do have a problem with the script. I get the following error message when the script is activated:

Interface Te1/1/1 interface resets threshold exceeded.

Creating mail header...

composite_device_health_interface.tcl e-mail notification sent!

can't read "i": no such variable

(reading value of variable to increment)

invoked from within

"incr i 6 "

     invoked from within

"$slave eval $Contents"

     (procedure "eval_script" line 7)

     invoked from within

"eval_script slave $scriptname"

     invoked from within

"if {$security_level == 1} {       #untrusted script

      interp create -safe slave

      interp share {} stdin slave

      interp share {} stdout slave


     (file "tmpsys:/lib/tcl/base.tcl" line 50)

Jul 24 16:36:44.630: %HA_EM-6-LOG: composite_device_health.tcl: Tcl policy execute failed:

Jul 24 16:36:44.630: %HA_EM-6-LOG: composite_device_health.tcl: can't read "i": no such variable

I think the problem is with the following line:

set body [format "%s\nSubject: %s\n" "$body" "Interface [ lindex $interface $i ] input errors threshold exceeded!

However, I don't know what impact it will have on the script if I remove $i

Any thoughts?


Cisco Employee

Re: Tcl Script Check Please

I don't see the problem.  The line you show is not it.  The script you attach does not appear to have a problem incrementing the value of i.

New Member

Re: Tcl Script Check Please

OK, Joseph, that's fine.

However, can you tell me why I get the following error message with the script on some devices but not on others?

Jul 25 22:53:38.974: %HA_EM-7-FMS_POLICY_MAX_ENTRIES: fh_schedule_policy: Class default: Maximum number of 64 script publish entries exceeded; some events have been discarded



Cisco Employee

Re: Tcl Script Check Please

New Member

Re: Tcl Script Check Please


Cheers mate.