Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_snmpv2.pl
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!
I added option for port. Added output to the first line if there is a critical or warning and a counter for number of checks OK.
You can enter multiple oid's, but the format MUST be ( label:oid:warn:crit:g:n,label:oid:warn:crit:l:a,... ),comma seperated.
Example (IBM Blade Chassis Voltages):
check_snmp.pl -H testbc -C public -p 161 -V 1 -t TESTBC_volt -O plus5:.1.3.6.1.4.1.2.3.51.2.2.2.1.1.0:4:3:l:n,plus3.3:.1.3.6.1.4.1.2.3.51.2.2.2.1.2.0:3:2.6:l:n,plus12:.1.3.6.1.4.1.2.3.51.2.2.2.1.3.0:11:10.5:l:n,minus5:.1.3.6.1.4.1.2.3.51.2.2.2.1.5.0:-4:-3.7:g:n,plus2.5:.1.3.6.1.4.1.2.3.51.2.2.2.1.6.0:2.2:2:l:n,plus1.8:.1.3.6.1.4.1.2.3.51.2.2.2.1.8.0:1.5:1.2:l:n
TESTBC_volt Status
OK: minus5 = -4.93
OK: plus2.5 = 2.48
OK: plus1.8 = 1.76
OK: plus3.3 = 3.26
OK: plus5 = 4.84
OK: plus12 = 11.78 | minus5=-4.93;-4;-3.7;0; plus2.5=2.48;2.2;2;0; plus1.8=1.76;1.5;1.2;0; plus3.3=3.26;3;2.6;0; plus5=4.84;4;3;0; plus12=11.78;11;10.5;0;
Example (Text Based Check value):
check_snmp.pl -H intbc -C public -p 161 -V 1 -t TESTBC_DIMM11 -O DIMM:.1.3.6.1.4.1.2.3.51.2.2.8.2.2.1.4.112:DIMM:dimm:x:a
TESTBC_DIMM11 Status
CRITICAL: DIMM = "DIMM 11" |
Nagios Command Definition:
define command{
command_name check_snmpv2
command_line $USER1$/check_snmp.pl -H $HOSTNAME$ -C $ARG1$ -p 161 -V $ARG2$ -t $ARG3$ -O $ARG4$
}
Here's the patch:
http://orfika.net/src/check_snmpv2.pl.patch
And if you want temperature I recommend you just download check_snmp_temperature.pl. Take a look at how its code too to learn how to write nagios plugins in Perl that retrieve data by SNMP. Then consider what is needed for your setup and write a new perl plugin (if it does not already exist) that you'd be proud of.
Yeah, I've been writing plugins for nagios/netsaint for over a decade now.
There are lots of plugin scripts out there that are wrappers. And most scripts that utilize protocols, need to wrap themselves around libraries.
The check_snmp plugin does not take into consideration the output a device will generate. It is not that good, but a good start for most people.
I have seen lots of scripts which give you this output, or that output, but never one I can ask for whatever output I am looking for. So I wrote script that is easy enough to do just that. I can use this script to check every OID on any any device, and out put the data so it is useful for performance data or not.
Yes, I am proud of all of my code. Because I wrote it, and it works, and it is simple to understand and expand upon.