diff options
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r-- | plugins/check_snmp.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 52ad31ea..2c62a230 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | * |
3 | * Nagios check_snmp plugin | 3 | * Monitoring check_snmp plugin |
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 1999-2007 Nagios Plugins Development Team | 6 | * Copyright (c) 1999-2007 Monitoring Plugins Development Team |
7 | * | 7 | * |
8 | * Description: | 8 | * Description: |
9 | * | 9 | * |
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | const char *progname = "check_snmp"; | 31 | const char *progname = "check_snmp"; |
32 | const char *copyright = "1999-2007"; | 32 | const char *copyright = "1999-2007"; |
33 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 33 | const char *email = "devel@monitoring-plugins.org"; |
34 | 34 | ||
35 | #include "common.h" | 35 | #include "common.h" |
36 | #include "runcmd.h" | 36 | #include "runcmd.h" |
@@ -459,7 +459,7 @@ main (int argc, char **argv) | |||
459 | /* Process this block for numeric comparisons */ | 459 | /* Process this block for numeric comparisons */ |
460 | /* Make some special values,like Timeticks numeric only if a threshold is defined */ | 460 | /* Make some special values,like Timeticks numeric only if a threshold is defined */ |
461 | if (thlds[i]->warning || thlds[i]->critical || calculate_rate) { | 461 | if (thlds[i]->warning || thlds[i]->critical || calculate_rate) { |
462 | ptr = strpbrk (show, "0123456789"); | 462 | ptr = strpbrk (show, "-0123456789"); |
463 | if (ptr == NULL) | 463 | if (ptr == NULL) |
464 | die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show); | 464 | die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show); |
465 | while (i >= response_size) { | 465 | while (i >= response_size) { |
@@ -963,11 +963,16 @@ validate_arguments () | |||
963 | if (seclevel == NULL) | 963 | if (seclevel == NULL) |
964 | xasprintf(&seclevel, "noAuthNoPriv"); | 964 | xasprintf(&seclevel, "noAuthNoPriv"); |
965 | 965 | ||
966 | if (secname == NULL) | ||
967 | die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname"); | ||
968 | |||
966 | if (strcmp(seclevel, "noAuthNoPriv") == 0) { | 969 | if (strcmp(seclevel, "noAuthNoPriv") == 0) { |
967 | numauthpriv = 2; | 970 | numauthpriv = 4; |
968 | authpriv = calloc (numauthpriv, sizeof (char *)); | 971 | authpriv = calloc (numauthpriv, sizeof (char *)); |
969 | authpriv[0] = strdup ("-l"); | 972 | authpriv[0] = strdup ("-l"); |
970 | authpriv[1] = strdup ("noAuthNoPriv"); | 973 | authpriv[1] = strdup ("noAuthNoPriv"); |
974 | authpriv[2] = strdup ("-u"); | ||
975 | authpriv[3] = strdup (secname); | ||
971 | } else { | 976 | } else { |
972 | if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) { | 977 | if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) { |
973 | usage2 (_("Invalid seclevel"), seclevel); | 978 | usage2 (_("Invalid seclevel"), seclevel); |
@@ -976,9 +981,6 @@ validate_arguments () | |||
976 | if (authproto == NULL ) | 981 | if (authproto == NULL ) |
977 | xasprintf(&authproto, DEFAULT_AUTH_PROTOCOL); | 982 | xasprintf(&authproto, DEFAULT_AUTH_PROTOCOL); |
978 | 983 | ||
979 | if (secname == NULL) | ||
980 | die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname"); | ||
981 | |||
982 | if (authpasswd == NULL) | 984 | if (authpasswd == NULL) |
983 | die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd"); | 985 | die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd"); |
984 | 986 | ||
@@ -1160,7 +1162,7 @@ print_help (void) | |||
1160 | printf (" %s\n", "-D, --output-delimiter=STRING"); | 1162 | printf (" %s\n", "-D, --output-delimiter=STRING"); |
1161 | printf (" %s\n", _("Separates output on multiple OID requests")); | 1163 | printf (" %s\n", _("Separates output on multiple OID requests")); |
1162 | 1164 | ||
1163 | printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 1165 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |
1164 | printf (" %s\n", "-e, --retries=INTEGER"); | 1166 | printf (" %s\n", "-e, --retries=INTEGER"); |
1165 | printf (" %s\n", _("Number of retries to be used in the requests")); | 1167 | printf (" %s\n", _("Number of retries to be used in the requests")); |
1166 | 1168 | ||