Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#575 check_snmp - integer parsing

Release (specify)
closed-invalid
nobody
5
2012-10-02
2012-10-02
Porjo
No

Plugin Version: check_snmp v1.4.16 (nagios-plugins 1.4.16)
Plugin Name: check_snmp
Operating System: Centos Linux 5
Architecture: Intel 32bit
Compiler: gcc

I am monitoring the power supply status on an APC PDU device. The snmp query returns integer 1 when status is good and integer 2 when status bad.

In order to test this with check_snmp I'm attempting to set a '-c' value that will make the check fail. I would expect that setting '-c 1' should result in CRITICAL and yet it doesn't:

./check_snmp -H 10.254.254.119 -o .1.3.6.1.4.1.318.1.1.12.4.1.1.0 -C netben -c 1 -v
/usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 10.254.254.119:161 .1.3.6.1.4.1.318.1.1.12.4.1.1.0
iso.3.6.1.4.1.318.1.1.12.4.1.1.0 = INTEGER: 1
SNMP OK - 1 | iso.3.6.1.4.1.318.1.1.12.4.1.1.0=1

I've found that if I use '-c 2:2', I get the result I would expect....but yet that makes no sense!?

./check_snmp -H 10.254.254.119 -o .1.3.6.1.4.1.318.1.1.12.4.1.1.0 -C netben -c 2:2 -v
/usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 10.254.254.119:161 .1.3.6.1.4.1.318.1.1.12.4.1.1.0
iso.3.6.1.4.1.318.1.1.12.4.1.1.0 = INTEGER: 1
SNMP CRITICAL - *1* | iso.3.6.1.4.1.318.1.1.12.4.1.1.0=1

Discussion

  • Porjo
    Porjo
    2012-10-02

    Looking at the source code I realised that I was simply misunderstanding the way the threshold range checking works. I've been using Nagios for years and never realised this!!

    This page (linked from the check_snmp man page) explains it well:

    http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT

     
  • Porjo
    Porjo
    2012-10-02

    • status: open --> closed-invalid