[Nagiosplug-help] check_snmp string handling issue and perfdata

Dánial Olsen DOL at ft.fo
Tue Sep 28 12:17:22 UTC 2010


> 
> You'll find that that OID location says it is returning a string
> value, rather than a numeric value. Adding -v -v -v should show this.

That's true:
./check_snmp  -H 10.0.0.2 -o .1.3.6.1.4.1.30155.2.1.2.1.5.3 -w 50 -c 60 -vvv 
/usr/local/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 10.0.0.2:161 .1.3.6.1.4.1.30155.2.1.2.1.5.3
iso.3.6.1.4.1.30155.2.1.2.1.5.3 = STRING: "53.00"
Processing oid 1 (line 1)
  oidname: iso.3.6.1.4.1.30155.2.1.2.1.5.3
  response:  = STRING: "53.00"
SNMP OK - "53.00" |

> The code was tightened because it was trying to do threshold checks
> against string values (which happened to be converted to a number ok),
> which doesn't make sense.
> 
> I guess a flag would be required to say "force this string value into
> a numeric (float?) value" and do the comparison. But I think the
> default behaviour for a string returned type should be to not compare
> numerically.

A "treat string as integer" option would be desirable in this case.
Until then I'll keep an 1.4.14 version of check_snmp around for this particular check.

--
Dánial




More information about the Nagiosplugin-help mailing list