[Nagiosplug-devel] [ nagiosplug-Bugs-3003419 ] check_snmp converts negative values to positive
SourceForge.net
noreply at sourceforge.net
Thu Aug 4 15:37:23 CEST 2011
Bugs item #3003419, was opened at 2010-05-18 17:59
Message generated for change (Comment added) made by mampfred
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3003419&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parsing problem
Group: v1.4.14
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Matt Rose (oesor)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_snmp converts negative values to positive
Initial Comment:
When thresholds are defined, check_snmp converts negative integer snmp get values to positive:
root at ops-00:/usr/local/nagios/libexec# ./check_snmp -V
check_snmp v1.4.14 (nagios-plugins 1.4.14)
root at ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::CurrentNoiseFloor.0 -w=~:-85 -c=~:-80 -vvvv
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] 192.168.1.100:161 DEVICE-MIB::CurrentNoiseFloor.0
DEVICE-MIB::CurrentNoiseFloor.0 = INTEGER: -97
Processing line 1
oidname: DEVICE-MIB::CurrentNoiseFloor.0
response: = INTEGER: -97
SNMP CRITICAL - *97* | DEVICE-MIB::CurrentNoiseFloor.0=97
root at ops-00:/usr/local/nagios/libexec# ./check_snmp -H 192.168.1.100 -o DEVICE-MIB::CurrentNoiseFloor.0 -vvvv
/usr/bin/snmpget -t 1 -r 5 -m ALL -v 1 [authpriv] 192.168.1.100:161 DEVICE-MIB::CurrentNoiseFloor.0
DEVICE-MIB::CurrentNoiseFloor.0 = INTEGER: -97
Processing line 1
oidname: DEVICE-MIB::CurrentNoiseFloor.0
response: = INTEGER: -97
SNMP OK - -97 | DEVICE-MIB::CurrentNoiseFloor.0=-97
----------------------------------------------------------------------
Comment By: Martin Rohrbach (mampfred)
Date: 2011-08-04 15:37
Message:
I agree with the fix from nobody42. The threshold problem looks similar,
the string for that is defined in lib/utils_base.h:
/* All possible characters in a threshold range */
#define NP_THRESHOLDS_CHARS "0123456789.:@~"
That should probably include a "-" as well.
----------------------------------------------------------------------
Comment By: Jan Sach ()
Date: 2011-06-23 13:32
Message:
Also when defining warning and critical tresholds it doesn't work correctly
when it comes to negative numbers:
It is possible to set the negative infinity and negative integer - for
example "~:-20"
or set the negative infinity and positive integer: "~:15".
That works as it should.
But the combined treshold "-10:30" wrongly puts the value "-8" outside
these limits, causing a warning or critical state (and the value "+8" is
correctly considered to be inside).
(note: I fixed the negative to positive perfdata converting bug using the
advice in the 1st comment, but i ran into this treshold problem)
I think it is important when fixing this bug to fix the tresholds parsing
as well.
The tresholds with both negative and positive limits are handy for
temperature measurement, power to batteries (which could be negative when
running from batteries and positive when charging them), etc.
----------------------------------------------------------------------
Comment By: Nobody (nobody42)
Date: 2011-03-19 14:49
Message:
The bug is located in line 404 of actual code
404 ptr = strpbrk (show, "0123456789");
should be changed to
404 ptr = strpbrk (show, "-0123456789");
403 if (thlds[i]->warning || thlds[i]->critical ||
calculate_rate) {
404 ptr = strpbrk (show, "0123456789");
405 if (ptr == NULL)
Can someone fix please ?
----------------------------------------------------------------------
Comment By: Matt Rose (oesor)
Date: 2010-05-18 18:20
Message:
s/thresholds are defined/thresholds are triggered/
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3003419&group_id=29880
More information about the Devel
mailing list