diff options
-rw-r--r-- | plugins/check_snmp.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index a8ee06fd..36a33270 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -297,6 +297,8 @@ main (int argc, char **argv) | |||
297 | show = strstr (response, "Gauge: ") + 7; | 297 | show = strstr (response, "Gauge: ") + 7; |
298 | else if (strstr (response, "Gauge32: ")) | 298 | else if (strstr (response, "Gauge32: ")) |
299 | show = strstr (response, "Gauge32: ") + 9; | 299 | show = strstr (response, "Gauge32: ") + 9; |
300 | else if (strstr (response, "INTEGER: ")) | ||
301 | show = strstr (response, "INTEGER: ") + 9; | ||
300 | else | 302 | else |
301 | show = response; | 303 | show = response; |
302 | p2 = show; | 304 | p2 = show; |
@@ -310,16 +312,17 @@ main (int argc, char **argv) | |||
310 | } | 312 | } |
311 | 313 | ||
312 | if (eval_method[i] & CRIT_GT || | 314 | if (eval_method[i] & CRIT_GT || |
313 | eval_method[i] & CRIT_LT || | 315 | eval_method[i] & CRIT_LT || |
314 | eval_method[i] & CRIT_GE || | 316 | eval_method[i] & CRIT_GE || |
315 | eval_method[i] & CRIT_LE || | 317 | eval_method[i] & CRIT_LE || |
316 | eval_method[i] & CRIT_EQ || | 318 | eval_method[i] & CRIT_EQ || |
317 | eval_method[i] & CRIT_NE || | 319 | eval_method[i] & CRIT_NE || |
318 | eval_method[i] & WARN_GT || | 320 | eval_method[i] & WARN_GT || |
319 | eval_method[i] & WARN_LT || | 321 | eval_method[i] & WARN_LT || |
320 | eval_method[i] & WARN_GE || | 322 | eval_method[i] & WARN_GE || |
321 | eval_method[i] & WARN_LE || | 323 | eval_method[i] & WARN_LE || |
322 | eval_method[i] & WARN_EQ || eval_method[i] & WARN_NE) { | 324 | eval_method[i] & WARN_EQ || |
325 | eval_method[i] & WARN_NE) { | ||
323 | p2 = strpbrk (p2, "0123456789"); | 326 | p2 = strpbrk (p2, "0123456789"); |
324 | response_value[i] = strtoul (p2, NULL, 10); | 327 | response_value[i] = strtoul (p2, NULL, 10); |
325 | iresult = check_num (i); | 328 | iresult = check_num (i); |
@@ -358,7 +361,7 @@ main (int argc, char **argv) | |||
358 | iresult = STATE_OK; | 361 | iresult = STATE_OK; |
359 | else if (eval_method[i] & CRIT_PRESENT) | 362 | else if (eval_method[i] & CRIT_PRESENT) |
360 | iresult = STATE_CRITICAL; | 363 | iresult = STATE_CRITICAL; |
361 | else | 364 | else if (eval_method[i] & WARN_PRESENT) |
362 | iresult = STATE_WARNING; | 365 | iresult = STATE_WARNING; |
363 | 366 | ||
364 | result = max_state (result, iresult); | 367 | result = max_state (result, iresult); |
@@ -376,7 +379,7 @@ main (int argc, char **argv) | |||
376 | 379 | ||
377 | i++; | 380 | i++; |
378 | 381 | ||
379 | } /* end while */ | 382 | } /* end while (ptr) */ |
380 | 383 | ||
381 | if (found == 0) | 384 | if (found == 0) |
382 | terminate | 385 | terminate |
@@ -395,10 +398,10 @@ main (int argc, char **argv) | |||
395 | if (spclose (child_process)) | 398 | if (spclose (child_process)) |
396 | result = max_state (result, STATE_WARNING); | 399 | result = max_state (result, STATE_WARNING); |
397 | 400 | ||
398 | if (nunits > 0) | 401 | /* if (nunits == 1 || i == 1) */ |
399 | printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); | 402 | /* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ |
400 | else | 403 | /* else */ |
401 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | 404 | printf ("%s %s -%s\n", label, state_text (result), outbuff); |
402 | 405 | ||
403 | return result; | 406 | return result; |
404 | } | 407 | } |