Home Directory Plugins Network and Systems Management Dynamic check for Cisco SNMP

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Dynamic check for Cisco SNMP

Current Version
1.1
Last Release Date
2012-11-15
Compatible With
  • Nagios 3.x
  • Nagios XI
Owner
License
GPL
Hits
54815
Files:
FileDescription
check_VciscoSNMPService Check V - 1.2
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Dynamic check for Cisco SNMP
Since Cisco lacks continuity when setting up their OID strings I wrote this check.
This check is written only for SNMP v3 but could be modified easily.
We didn't want to add hundreds of checks for every possible OID as it would simply clutter our Nagios XI setup.
This would cause multiple issues going forward with maintaining the server.

For this reason I outsourced some of the check data to flat files; as they are easier to maintain and give us
the benefit of an “out of sight, out of mind” setup.
The check expects a directory called mibcisco, one directory level below the libexec directory.
Within this directory it reads in control files. These files are your IP address or hostname, depending on how you setup your devices in Nagios.

With in the file it expects to find two environment variables called
AUTHP = Auth password
PRIVP = Priv password
COMMUNITY = Community/username

These are the first three lines of the file. It's important that the line count is correct as it's a control in the service checks themselves.

Starting on line 5 the configurations start and use pipes as a separator.
DESCRIPTION|OID|EXPECTED-VALUE
See below for a complete example of the file
--------------------------
AUTHP='123abc'
PRIVP='abc123'
COMMUNITY='public'
##############
#|GigabitEthernet3/5: Trunk to switch.example.com:fa0/24|IF-MIB::ifOperStatus.2|up(1)
--------------------------
Once you've put in your control files add the check into Nagios. The script expects to have $ARG1$.
This first argument is the line number of the check you want to perform.
So in the example file above our service would be created and called something generic like
“Cisco SNMP Check 1” and have $ARG1$ = 1

This would pull the 5th line of the file above and check that OID against it's expected value.
The description will always be returned in the results.
If you were checking 4 switches with 7 service checks like below.
“Cisco SNMP Check 1” and have $ARG1$ = 1
“Cisco SNMP Check 2” and have $ARG1$ = 2
“Cisco SNMP Check 3” and have $ARG1$ = 3
“Cisco SNMP Check 4” and have $ARG1$ = 4
“Cisco SNMP Check 5” and have $ARG1$ = 5
“Cisco SNMP Check 6” and have $ARG1$ = 6
“Cisco SNMP Check 7” and have $ARG1$ = 7
Later if you added another switch with 10 checks you would simply extend these checks associating them as
needed with devices.
Keeping it generic like this creates a cleaner configuration within Nagios and in our deployment an easier way to manage systems.

Working on V2 that would allow ranges for expected results. This would be for looking at BGP and so on to ensure propigation of routes.

Change Log -|
1.0
1.1 - Left out argument to capture line number and had to make a change to the flat file system.
- While reading it in some lines were giving an error and Nagios was dropping out.
1.2 - gggrrr.. Couldn't leave this alone. I made the count add 4 so Check 1 would have an $ARG1$ = 1