| Anonymous | Login | Signup for a new account | 2013-05-20 13:29 EDT |
| Main | My View | View Issues | Change Log | Roadmap |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||
| 0000265 | [Nagios Plugins] Other / Unknown | major | always | 2011-10-24 09:23 | 2012-09-18 09:11 | ||
| Reporter | candlerb | View Status | public | ||||
| Assigned To | |||||||
| Priority | normal | Resolution | open | ||||
| Status | closed | ||||||
| Summary | 0000265: check_snmp threshold breaks with negative values | ||||||
| Description |
The INTEGER type in SNMP is a signed 32-bit value. However check_snmp breaks with negative values. (1) The negative sign is dropped as soon as you apply -w or -c command line flags. # /usr/lib/nagios/plugins/check_snmp -vvv -H 192.168.5.119 -C public -o .1.3.6.1.2.1.25.2.3.1.5.2 /usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 192.168.5.119:161 .1.3.6.1.2.1.25.2.3.1.5.2 iso.3.6.1.2.1.25.2.3.1.5.2 = INTEGER: -632823937 Processing line 1 oidname: iso.3.6.1.2.1.25.2.3.1.5.2 response: = INTEGER: -632823937 SNMP OK - -632823937 | iso.3.6.1.2.1.25.2.3.1.5.2=-632823937 # /usr/lib/nagios/plugins/check_snmp -vvv -H 192.168.5.119 -C public -o .1.3.6.1.2.1.25.2.3.1.5.2 -w 0 /usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] 192.168.5.119:161 .1.3.6.1.2.1.25.2.3.1.5.2 iso.3.6.1.2.1.25.2.3.1.5.2 = INTEGER: -632823937 Processing line 1 oidname: iso.3.6.1.2.1.25.2.3.1.5.2 response: = INTEGER: -632823937 SNMP WARNING - *632823937* | iso.3.6.1.2.1.25.2.3.1.5.2=632823937 <<< NOTE! (2) Any threshold with a negative value is rejected as invalid # /usr/lib/nagios/plugins/check_snmp -vvv -H 192.168.5.119 -C public -o .1.3.6.1.2.1.25.2.3.1.5.2 -w -5:-3 Range format incorrect |
||||||
| Additional Information |
I am guessing problem (1) could be fixed like this: --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -401,7 +401,7 @@ main (int argc, char **argv) /* Process this block for numeric comparisons */ /* Make some special values,like Timeticks numeric only if a thr if (thlds[i]->warning || thlds[i]->critical || calculate_rate) { - ptr = strpbrk (show, "0123456789"); + ptr = strpbrk (show, "-0123456789"); if (ptr == NULL) die (STATE_UNKNOWN,_("No valid data returned")); response_value[i] = strtod (ptr, NULL); and that problem (2) could be fixed like this: --- a/lib/utils_base.h +++ b/lib/utils_base.h @@ -62,7 +62,7 @@ int check_range(double, range *); int get_status(double, thresholds *); /* All possible characters in a threshold range */ -#define NP_THRESHOLDS_CHARS "0123456789.:@~" +#define NP_THRESHOLDS_CHARS "-0123456789.:@~" char *np_escaped_string (const char *); |
||||||
| Tags | No tags attached. | ||||||
| OS | Ubuntu | ||||||
| OS Version | 10.04.3 LTS | ||||||
| Attached Files | |||||||
|
|
|||||||
Notes |
|
|
(0000364) candlerb (reporter) 2011-10-24 12:00 |
I have rebuild check_snmp from source, and those two one-line changes do appear to fix the problem. |
|
(0000521) calestyo (reporter) 2012-07-31 19:00 |
Forwarded to: https://sourceforge.net/tracker/?func=detail&aid=3552834&group_id=29880&atid=397597 [^] |
| Mantis 1.1.7[^] Copyright © 2000 - 2008 Mantis Group |