[Nagiosplug-devel] check_snmp tries to be too smart

John P. Rouillard rouilj at cs.umb.edu
Mon Jan 29 17:09:14 CET 2007


Hi all:

I am using:

  check_snmp (nagios-plugins 1.4.3) 1.58

It looks like check_snmp tries to be too smart and as a result
requires exposure of the snmp community names.

I have a ~/.snmp/snmp.conf file set up with the contents:

 defCommunity XyXyXyXyXyXy
 defVersion 2c

which allows:

 %snmpget localhost sysUpTime.0
 SNMPv2-MIB::sysUpTime.0 = Timeticks: (12766176) 1 day, 11:27:41.76

to work just fine. However when using check_snmp
as:

  %/usr/lib/nagios/plugins/check_snmp -H localhost -o sysUpTime.0

it fails when it runs the command:

  /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c public localhost:161  sysUpTime.0

Can we modify the operation of -C so that an empty argument prevents
the addition of '-c public' to the snmpget command.  I don't think it
is possible to have a null snmp password, so maybe setting an empty
community string could do this. Currently "-C ''" generates an error
by creating the command line:

  /usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c localhost:161  sysUpTime.0

which is a syntax error for snmpget. So setting a null/empty community
string causes a plugin failure currently, so changing it to be valid
should be fine since I can't imagine anybody using the current
functionality. (Also just a thought: what happens if the community
string has a space in it? Is snmpget called via a shell or is argv
created and exec'ed directly?)

Also there is no way to modify the output format from snmpget/getnext.
This leads to weirdness (lines split for readability) like:

  SNMP OK - Timeticks: (12862120) 1 day, 11:43:41.20 | 
     SNMPv2-MIB::sysUpTime.0=Timeticks: (12862120) 1 day, 11:43:41.20;;;;

definitely an invalid format for performance data and

  SNMP OK - up(1) | IF-MIB::ifOperStatus.1=up(1);;;;  

again something not easily graphable (although both could be handled
by using regexp matching/extraction of the interesting data item).

Compare that to:

 snmpget -t 1 -r 5 -m ALL -v 2c localhost:161 sysUpTime.0 ifOperStatus.1
 SNMPv2-MIB::sysUpTime.0 = Timeticks: (12850236) 1 day, 11:41:42.36
 IF-MIB::ifOperStatus.1 = INTEGER: up(1)

which generates the output displayed above and:

  snmpget -t 1 -r 5 -m ALL -v 2c -OtQe localhost:161 sysUpTime.0 ifOperStatus.1
  SNMPv2-MIB::sysUpTime.0 = 12849618
  IF-MIB::ifOperStatus.1 = 1

which produces pure numerical output for the queried OID's. Maybe
adding a '-O' option to check_snmp that allows passing output format
arguments to the underlying snmpget/snmpgetnext would be useful.

				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.




More information about the Devel mailing list