cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6636
Views
19
Helpful
4
Comments
Joe Clarke
Cisco Employee
Cisco Employee

The SNMP event detector in NX-OS does not support a delta or incremental polling type so counter objects cannot be properly monitored.  This makes it difficult to monitor things such as interface utilization.  This solution repurposes the SNMP ED along with a Tcl script and a hidden VSH command to provide syslog alerting if any of a list of interfaces exceeds a configurable threshold.

First, configure an EEM applet using the SNMP ED.  This applet will monitor sysUpTime and fire whenever sysUpTime is greater than 0.  This will always be true.  The point of this applet is to run each time the polling interval pops and execute the Tcl script.

event manager applet ifTimer

event snmp oid 1.3.6.1.2.1.1.3.0 get-type exact entry-op gt entry-val 0 poll-interval 30

action 1.0 cli tclsh bootflash:if_util.tcl

In this example, the applet will run every 30 seconds and fire off the if_util.tcl script.  It is the job of this script to check the interface utilization.

The attached Tcl script will check two EEM environment variables.  The first provides a comma-separated list of interfaces to check.  The second specifies the threshold.

event manager environment if_util_intfs "e3/1,e3/2,e4/1"

event manager environment if_util_threshold "90"

In this example, the script will monitor the utilization of Ethernet3/1, Ethernet3/2, and Ethernet4/1 (using the "show interface" command).  If any of the iterfaces' utilization is over 90%, a syslog message will be generated for that interface.  That syslog will look like:

%USER-2-SYSTEM_MSG: systest from  0: Interface e3/1 exceeded 90% utilization threshold: Tx: 91%, Rx: 60% - vsh

This solution has been tested on a Nexus 7K running 6.0(3).  NX-OS 5.2 or higher should also work with this solution.

Comments

Hello Joseph,

I'm a little confused.

I thought tha NX-OS couldn't do Tcl?

Cheers

Joe Clarke
Cisco Employee
Cisco Employee

Calling a Tcl script from EEM or the scheduler is not officially supported on NX-OS yet.  Meaning if something goes wrong, there is no way to get support for it.  However, it does work given a new enough version of NX-OS.

quintedwards
Level 1
Level 1

I know this is an extremely old thread, but I thought I would reply as I would love to get this working on my switch. I am able to get this to work on my virtual switches, but not on a physical Cisco 9504 version 9.3(2). If I run the script by itself on the switch (switch-tcl# <copy and paste script>) it works fine. The syslog message that populates in lieu of the appropriate message is %USER-6-SYSTEM_MSG: case p, optarg = admin - vsh.bin. I have a Cisco Case opened on this but I thought I would post here as well. 

My scripting level is probably a 2 at most, so any help is greatly appreciated! 

 

Respectfully,

Quinton

quintedwards
Level 1
Level 1

Posting this resolution in case anyone else has minor issues that I did. It turns out that the script permissions needed to be modified. This script works very well! Thanks again for sharing!

 

Respectfully,
Quinton 

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:

Review Cisco Networking for a $25 gift card