diff options
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r-- | plugins/check_snmp.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 544c5c0b..0aafd951 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -199,10 +199,10 @@ main (int argc, char **argv) | |||
199 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, | 199 | PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, |
200 | "[authpriv]", server_address, port, oid); | 200 | "[authpriv]", server_address, port, oid); |
201 | } | 201 | } |
202 | 202 | ||
203 | if (verbose) | 203 | if (verbose) |
204 | printf ("%s\n", command_line); | 204 | printf ("%s\n", command_line); |
205 | 205 | ||
206 | 206 | ||
207 | /* run the command */ | 207 | /* run the command */ |
208 | child_process = spopen (command_line); | 208 | child_process = spopen (command_line); |
@@ -236,7 +236,7 @@ main (int argc, char **argv) | |||
236 | if (copylen > sizeof(perfstr)-strlen(perfstr)-1) | 236 | if (copylen > sizeof(perfstr)-strlen(perfstr)-1) |
237 | copylen = sizeof(perfstr)-strlen(perfstr)-1; | 237 | copylen = sizeof(perfstr)-strlen(perfstr)-1; |
238 | ptr2 = ptr; | 238 | ptr2 = ptr; |
239 | ptr = foo; | 239 | ptr = foo; |
240 | 240 | ||
241 | if (ptr == NULL) | 241 | if (ptr == NULL) |
242 | break; | 242 | break; |
@@ -309,7 +309,7 @@ main (int argc, char **argv) | |||
309 | eval_method[i] & WARN_EQ || | 309 | eval_method[i] & WARN_EQ || |
310 | eval_method[i] & WARN_NE) { | 310 | eval_method[i] & WARN_NE) { |
311 | p2 = strpbrk (p2, "0123456789"); | 311 | p2 = strpbrk (p2, "0123456789"); |
312 | if (p2 == NULL) | 312 | if (p2 == NULL) |
313 | die (STATE_UNKNOWN,_("No valid data returned")); | 313 | die (STATE_UNKNOWN,_("No valid data returned")); |
314 | response_value[i] = strtoul (p2, NULL, 10); | 314 | response_value[i] = strtoul (p2, NULL, 10); |
315 | iresult = check_num (i); | 315 | iresult = check_num (i); |
@@ -346,7 +346,7 @@ main (int argc, char **argv) | |||
346 | iresult = STATE_CRITICAL; | 346 | iresult = STATE_CRITICAL; |
347 | else if (eval_method[i] & WARN_PRESENT) | 347 | else if (eval_method[i] & WARN_PRESENT) |
348 | iresult = STATE_WARNING; | 348 | iresult = STATE_WARNING; |
349 | else if (response && iresult == STATE_DEPENDENT) | 349 | else if (response && iresult == STATE_DEPENDENT) |
350 | iresult = STATE_OK; | 350 | iresult = STATE_OK; |
351 | } | 351 | } |
352 | 352 | ||
@@ -473,7 +473,7 @@ process_arguments (int argc, char **argv) | |||
473 | usage5 (); | 473 | usage5 (); |
474 | case 'h': /* help */ | 474 | case 'h': /* help */ |
475 | print_help (); | 475 | print_help (); |
476 | exit (STATE_OK); | 476 | exit (STATE_OK); |
477 | case 'V': /* version */ | 477 | case 'V': /* version */ |
478 | print_revision (progname, revision); | 478 | print_revision (progname, revision); |
479 | exit (STATE_OK); | 479 | exit (STATE_OK); |
@@ -571,7 +571,7 @@ process_arguments (int argc, char **argv) | |||
571 | jj++; | 571 | jj++; |
572 | ii++; | 572 | ii++; |
573 | } | 573 | } |
574 | if (c == 'E') | 574 | if (c == 'E') |
575 | eval_method[j+1] |= WARN_PRESENT; | 575 | eval_method[j+1] |= WARN_PRESENT; |
576 | else if (c == 'e') | 576 | else if (c == 'e') |
577 | eval_method[j+1] |= CRIT_PRESENT; | 577 | eval_method[j+1] |= CRIT_PRESENT; |
@@ -672,7 +672,7 @@ process_arguments (int argc, char **argv) | |||
672 | 672 | ||
673 | if (community == NULL) | 673 | if (community == NULL) |
674 | community = strdup (DEFAULT_COMMUNITY); | 674 | community = strdup (DEFAULT_COMMUNITY); |
675 | 675 | ||
676 | 676 | ||
677 | 677 | ||
678 | return validate_arguments (); | 678 | return validate_arguments (); |
@@ -687,8 +687,8 @@ process_arguments (int argc, char **argv) | |||
687 | 687 | ||
688 | <para>&PROTO_validate_arguments;</para> | 688 | <para>&PROTO_validate_arguments;</para> |
689 | 689 | ||
690 | <para>Checks to see if the default miblist needs to be loaded. Also verifies | 690 | <para>Checks to see if the default miblist needs to be loaded. Also verifies |
691 | the authentication and authorization combinations based on protocol version | 691 | the authentication and authorization combinations based on protocol version |
692 | selected.</para> | 692 | selected.</para> |
693 | 693 | ||
694 | <para></para> | 694 | <para></para> |
@@ -713,16 +713,16 @@ validate_arguments () | |||
713 | 713 | ||
714 | 714 | ||
715 | /* Need better checks to verify seclevel and authproto choices */ | 715 | /* Need better checks to verify seclevel and authproto choices */ |
716 | 716 | ||
717 | if (seclevel == NULL) | 717 | if (seclevel == NULL) |
718 | asprintf (&seclevel, "noAuthNoPriv"); | 718 | asprintf (&seclevel, "noAuthNoPriv"); |
719 | 719 | ||
720 | 720 | ||
721 | if (authproto == NULL ) | 721 | if (authproto == NULL ) |
722 | asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | 722 | asprintf(&authproto, DEFAULT_AUTH_PROTOCOL); |
723 | 723 | ||
724 | 724 | ||
725 | 725 | ||
726 | if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ | 726 | if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ |
727 | asprintf(&proto, DEFAULT_PROTOCOL); | 727 | asprintf(&proto, DEFAULT_PROTOCOL); |
728 | asprintf(&authpriv, "%s%s", "-c ", community); | 728 | asprintf(&authpriv, "%s%s", "-c ", community); |
@@ -732,7 +732,7 @@ validate_arguments () | |||
732 | } | 732 | } |
733 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ | 733 | else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ |
734 | asprintf(&proto, "%s", "3"); | 734 | asprintf(&proto, "%s", "3"); |
735 | 735 | ||
736 | if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { | 736 | if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { |
737 | asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); | 737 | asprintf(&authpriv, "%s", "-l noAuthNoPriv" ); |
738 | } | 738 | } |
@@ -752,12 +752,12 @@ validate_arguments () | |||
752 | } | 752 | } |
753 | asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); | 753 | asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); |
754 | } | 754 | } |
755 | 755 | ||
756 | } | 756 | } |
757 | else { | 757 | else { |
758 | usage2 (_("Invalid SNMP version"), proto); | 758 | usage2 (_("Invalid SNMP version"), proto); |
759 | } | 759 | } |
760 | 760 | ||
761 | return OK; | 761 | return OK; |
762 | } | 762 | } |
763 | 763 | ||