diff options
Diffstat (limited to 'plugins/check_snmp.c')
| -rw-r--r-- | plugins/check_snmp.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 2f970b3d..8e977e82 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -97,6 +97,7 @@ char *community = NULL; | |||
| 97 | char oid[MAX_INPUT_BUFFER] = ""; | 97 | char oid[MAX_INPUT_BUFFER] = ""; |
| 98 | char *label = NULL; | 98 | char *label = NULL; |
| 99 | char *units = NULL; | 99 | char *units = NULL; |
| 100 | char *port = NULL; | ||
| 100 | char string_value[MAX_INPUT_BUFFER] = ""; | 101 | char string_value[MAX_INPUT_BUFFER] = ""; |
| 101 | char **labels = NULL; | 102 | char **labels = NULL; |
| 102 | char **unitv = NULL; | 103 | char **unitv = NULL; |
| @@ -259,7 +260,7 @@ main (int argc, char **argv) | |||
| 259 | iresult = STATE_WARNING; | 260 | iresult = STATE_WARNING; |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | result = max (result, iresult); | 263 | result = max_state (result, iresult); |
| 263 | 264 | ||
| 264 | if (nlabels > 1 && i < nlabels && labels[i] != NULL) | 265 | if (nlabels > 1 && i < nlabels && labels[i] != NULL) |
| 265 | outbuff = ssprintf | 266 | outbuff = ssprintf |
| @@ -290,14 +291,14 @@ main (int argc, char **argv) | |||
| 290 | 291 | ||
| 291 | /* WARNING if output found on stderr */ | 292 | /* WARNING if output found on stderr */ |
| 292 | if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) | 293 | if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) |
| 293 | result = max (result, STATE_WARNING); | 294 | result = max_state (result, STATE_WARNING); |
| 294 | 295 | ||
| 295 | /* close stderr */ | 296 | /* close stderr */ |
| 296 | (void) fclose (child_stderr); | 297 | (void) fclose (child_stderr); |
| 297 | 298 | ||
| 298 | /* close the pipe */ | 299 | /* close the pipe */ |
| 299 | if (spclose (child_process)) | 300 | if (spclose (child_process)) |
| 300 | result = max (result, STATE_WARNING); | 301 | result = max_state (result, STATE_WARNING); |
| 301 | 302 | ||
| 302 | if (nunits > 0) | 303 | if (nunits > 0) |
| 303 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | 304 | printf ("%s %s -%s\n", label, state_text (result), outbuff); |
| @@ -348,6 +349,12 @@ process_arguments (int argc, char **argv) | |||
| 348 | if (units == NULL) | 349 | if (units == NULL) |
| 349 | units = strscpy (NULL, ""); | 350 | units = strscpy (NULL, ""); |
| 350 | 351 | ||
| 352 | if (port == NULL) | ||
| 353 | port = strscpy(NULL,"161"); | ||
| 354 | |||
| 355 | if (port == NULL) | ||
| 356 | port = strscpy(NULL,"161"); | ||
| 357 | |||
| 351 | return c; | 358 | return c; |
| 352 | } | 359 | } |
| 353 | 360 | ||
| @@ -409,6 +416,7 @@ call_getopt (int argc, char **argv) | |||
| 409 | case 'r': | 416 | case 'r': |
| 410 | case 'l': | 417 | case 'l': |
| 411 | case 'u': | 418 | case 'u': |
| 419 | case 'p': | ||
| 412 | i++; | 420 | i++; |
| 413 | } | 421 | } |
| 414 | 422 | ||
| @@ -608,6 +616,8 @@ print_help (char *cmd) | |||
| 608 | " (default is \"public\")\n" | 616 | " (default is \"public\")\n" |
| 609 | " -u, --units=STRING\n" | 617 | " -u, --units=STRING\n" |
| 610 | " Units label(s) for output data (e.g., 'sec.').\n" | 618 | " Units label(s) for output data (e.g., 'sec.').\n" |
| 619 | " -p, --port=STRING\n" | ||
| 620 | " TCP port number target is listening on.\n" | ||
| 611 | " -d, --delimiter=STRING\n" | 621 | " -d, --delimiter=STRING\n" |
| 612 | " Delimiter to use when parsing returned data. Default is \"%s\"\n" | 622 | " Delimiter to use when parsing returned data. Default is \"%s\"\n" |
| 613 | " Any data on the right hand side of the delimiter is considered\n" | 623 | " Any data on the right hand side of the delimiter is considered\n" |
