diff options
Diffstat (limited to 'plugins/check_snmp.c')
| -rw-r--r-- | plugins/check_snmp.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 9d919422..cb7fb7a0 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -170,7 +170,6 @@ main (int argc, char **argv) | |||
| 170 | char *state_string=NULL; | 170 | char *state_string=NULL; |
| 171 | size_t response_length, current_length, string_length; | 171 | size_t response_length, current_length, string_length; |
| 172 | char *temp_string=NULL; | 172 | char *temp_string=NULL; |
| 173 | int is_numeric=0; | ||
| 174 | time_t current_time; | 173 | time_t current_time; |
| 175 | double temp_double; | 174 | double temp_double; |
| 176 | time_t duration; | 175 | time_t duration; |
| @@ -336,29 +335,24 @@ main (int argc, char **argv) | |||
| 336 | /* We strip out the datatype indicator for PHBs */ | 335 | /* We strip out the datatype indicator for PHBs */ |
| 337 | if (strstr (response, "Gauge: ")) { | 336 | if (strstr (response, "Gauge: ")) { |
| 338 | show = strstr (response, "Gauge: ") + 7; | 337 | show = strstr (response, "Gauge: ") + 7; |
| 339 | is_numeric++; | ||
| 340 | } | 338 | } |
| 341 | else if (strstr (response, "Gauge32: ")) { | 339 | else if (strstr (response, "Gauge32: ")) { |
| 342 | show = strstr (response, "Gauge32: ") + 9; | 340 | show = strstr (response, "Gauge32: ") + 9; |
| 343 | is_numeric++; | ||
| 344 | } | 341 | } |
| 345 | else if (strstr (response, "Counter32: ")) { | 342 | else if (strstr (response, "Counter32: ")) { |
| 346 | show = strstr (response, "Counter32: ") + 11; | 343 | show = strstr (response, "Counter32: ") + 11; |
| 347 | is_numeric++; | ||
| 348 | is_counter=1; | 344 | is_counter=1; |
| 349 | if(!calculate_rate) | 345 | if(!calculate_rate) |
| 350 | strcpy(type, "c"); | 346 | strcpy(type, "c"); |
| 351 | } | 347 | } |
| 352 | else if (strstr (response, "Counter64: ")) { | 348 | else if (strstr (response, "Counter64: ")) { |
| 353 | show = strstr (response, "Counter64: ") + 11; | 349 | show = strstr (response, "Counter64: ") + 11; |
| 354 | is_numeric++; | ||
| 355 | is_counter=1; | 350 | is_counter=1; |
| 356 | if(!calculate_rate) | 351 | if(!calculate_rate) |
| 357 | strcpy(type, "c"); | 352 | strcpy(type, "c"); |
| 358 | } | 353 | } |
| 359 | else if (strstr (response, "INTEGER: ")) { | 354 | else if (strstr (response, "INTEGER: ")) { |
| 360 | show = strstr (response, "INTEGER: ") + 9; | 355 | show = strstr (response, "INTEGER: ") + 9; |
| 361 | is_numeric++; | ||
| 362 | } | 356 | } |
| 363 | else if (strstr (response, "STRING: ")) { | 357 | else if (strstr (response, "STRING: ")) { |
| 364 | show = strstr (response, "STRING: ") + 8; | 358 | show = strstr (response, "STRING: ") + 8; |
| @@ -410,15 +404,17 @@ main (int argc, char **argv) | |||
| 410 | } | 404 | } |
| 411 | 405 | ||
| 412 | } | 406 | } |
| 413 | else if (strstr (response, "Timeticks: ")) | 407 | else if (strstr (response, "Timeticks: ")) { |
| 414 | show = strstr (response, "Timeticks: "); | 408 | show = strstr (response, "Timeticks: "); |
| 409 | } | ||
| 415 | else | 410 | else |
| 416 | show = response; | 411 | show = response; |
| 417 | 412 | ||
| 418 | iresult = STATE_DEPENDENT; | 413 | iresult = STATE_DEPENDENT; |
| 419 | 414 | ||
| 420 | /* Process this block for numeric comparisons */ | 415 | /* Process this block for numeric comparisons */ |
| 421 | if (is_numeric) { | 416 | /* Make some special values,like Timeticks numeric only if a threshold is defined */ |
| 417 | if (thlds[i]->warning || thlds[i]->critical || calculate_rate) { | ||
| 422 | ptr = strpbrk (show, "0123456789"); | 418 | ptr = strpbrk (show, "0123456789"); |
| 423 | if (ptr == NULL) | 419 | if (ptr == NULL) |
| 424 | die (STATE_UNKNOWN,_("No valid data returned")); | 420 | die (STATE_UNKNOWN,_("No valid data returned")); |
