[Nagiosplug-help] check_snmp string parsing not working

Ton Voon tonvoon at gmail.com
Fri Sep 3 16:19:57 CEST 2010


On 3 Sep 2010, at 14:15, Gothard, Morgan wrote:

> Sometime between 1.4.11 and 1.4.15 this plugin stopped parsing  
> string output.  The result of this is that all my check commands  
> that use the --string or --regex options now *always* return an OK  
> result.  If checked this with multiple MIBs, OIDs, and devices.
>
> Version 1.4.11 output:
>
> ./check_snmp --protocol=2c --hostname=host1 --community=public -- 
> oid=CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit -r active  
> -vvvv
> /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c -c public host1:161  CISCO- 
> FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit
> CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit = INTEGER:  
> active(9)
>
> SNMP OK - active(9) | CISCO-FIREWALL- 
> MIB::cfwHardwareStatusValue.primaryUnit=active(9)
>
>
> Version 1.4.15 output:
>
> ./check_snmp --protocol=2c --hostname=host1 --community=public -- 
> oid=CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit –r  
> active  -vvvv
> /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c [authpriv] host1:161 CISCO- 
> FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit
> CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit = INTEGER:  
> active(9)
> Processing oid 1 (line 1)
>   oidname: CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit
>   response:  = INTEGER: active(9)
> SNMP OK - 9 | CISCO-FIREWALL-MIB::cfwHardwareStatusValue.primaryUnit=9

The code was tightened around here. I'm guessing this is failing  
because the returned value is an integer, not a string, so a string  
comparison doesn't make sense.

You could do a comparison on the value instead, so -c 9:9 should  
return an error when it is not 9.

Ton

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20100903/a4af1da4/attachment.html>


More information about the Help mailing list