cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
14475
Views
25
Helpful
38
Replies

Tcl & EEM forum

Mel Popple
Level 1
Level 1

How about a forum dedicated to Tcl scripting and using Embedded Event Manager?

All useful for testing and debugging.

38 Replies 38

Joe Clarke
Cisco Employee
Cisco Employee

You can ask EEM and Tcl questions in the Network Manager forum. I try to answer all of them. There is also the EEM scripting repository at http://www.cisco.com/go/ciscobeyond which has numerous example policies. I have even posted some tclsh examples as well.

Can CiscoWorks LMS be used to deploy and/or manage EEM scipts on Catalyst switches?

LMS 3.1 does have some capability to deploy EEM policies on devices via Netconfig. However, this is only phase 1 level integration. A more comprehensive IDE for EEM is available from http://www.nidussoft.com/ , called IDEEM.

Hi Joe,

The software you mentioned here, IDEEM, can not to be googled, and the link is redirecting to a weird website, Could you please provide the download link again ?

Looks like Nidus has gone out of business.  We have a partner, Progrizon, that does EEM consulting and has some tools to facilitate policy creation and deployment.

Please advise on how to use MS Visual C++ 6.0 to compile tcl. I already configured the VC ++ directories and included the the tcl's lib.

Thanks

Message was edited by: limjohn23

I've never compiled Tcl on Windows.  However, you don't need to do this.  You can get binaries from http://www.activestate.com/activetcl .  You may also be able to find some VC++ instructions from ActiveState as well.

Hi,

    Thanks a lot and that is very helpful, anyways, I am trying to make a script that will send a customize syslog message priority 3 (Critical) when an interface is down and run the script every 60 seconds. I get stuck on sending the syslog msg. as priority 3. Attached is the script. Hope you can give me some advice.

Many thanks

This is what you want.

Thanks Joe, I greatly appreciate it.

    But when I try to run it it gives me an error. I am running it on Router 1800 with IOS 12.4 (20) T, EEM Version 2.4. Is there any configuration I need to do on the device prior running the script. I registered the cron_entry and its value as well as the event_register_syslog and event_register_timer under event manager environment. Is there anything I am missing here. I am running the script through the TFTP.

Thanks you in advance,

John

You need to create a directory on flash to hold your EEM policies.  Call it policies.  Copy your EEM policy into this directory (make sure it ends in .tcl).  Then configure the following:

event manager directory user policy flash:/policies

event manager policy gigabitdown.tcl

Once installed, the script will run at 12:01 am.

Hi Joe,

    How's going,,,Hope that you can guide me on this mini project. Below is the tasks that I would like to accomplish. Many thanks in advance.

1.) Run show command on the switch that will give us a list of the interfaces that are configured as uplinks.

2.) For each line of output from the results in 1, do the following:

           a.) Parse the output data to just get the interface name.

           b.) Run a show command on the interface name to get the utilization stats for the past 5 min.

           c.) If utilization is greater than x, then generate s syslog message with message stating hight utilization on the specific interface on this specific host

            d.) continue loop until results of 1 are finished.

On #1, Can I use

set output [run_cli "sh ip interface brief"]

foreach line [    

if lsearch $output up = 2 #check every line if status and protocol are both in up state

   [split $output "\n"] puts [lindex $line 0]

Provided you have my run_cli function defined, the first part will work.  Then you want to do something like:

set output [run_cli "show ip int brief | inc up"]

foreach line [split $output "\n"] {

    regsub -all {\s+} $line " " line

    set ifname [lindex $line 0]

    if { [lindex $line end] == "up" && [lindex $line end-1] == "up" } {

        # Get utilization

        # if utilization > threshold, action_syslog msg ...

   }

}

Hi, and thanks for the quick response. Can you please take a look the codes below...Will this do a loop for all interfaces that are in up state.

Please take a look the attached file.

Thanks again..

set output [run_cli "show ip int brief | inc up"]

foreach line [split $output "\n"]

{     regsub -all {\s+} $line " " line   

set ifname [lindex $line 0]   

if { [lindex $line end] == "up" && [lindex $line end-1] == "up" } {        

# Get utilization    

      set utili_val [run_cli "sh int $ifname | inc load"]        

#getting the value of txload and rxload         

   { [regexp -line -nocase {.*txload ([0-9]+)/255, rxload ([0-9]+)/255}             

$utili_val complete_string tx_val rx_val] }        

#calculate the txload percentage; if more than 80 send syslog err          

    if [expr ($tx_val/255 * 100 >= 80.00]                    

action_syslog priority err "ERROR: $ifname TXLOAD is: $tx_val; more than 80 percent"      

  #calculate the rxload percentage; if more than 80 send syslog err      

        if [expr ($rx_val/255 * 100 >= 80.00]                    

action_syslog priority err "ERROR: $ifname RXLOAD is: $rx_val; more than 80 percent"  

}

}

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:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco