diff options
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r-- | plugins/check_snmp.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 41a5ea1a..94b75b9f 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -188,7 +188,7 @@ main (int argc, char **argv) | |||
188 | snmpcmd = strdup (PATH_TO_SNMPGET); | 188 | snmpcmd = strdup (PATH_TO_SNMPGET); |
189 | } | 189 | } |
190 | 190 | ||
191 | /* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ | 191 | /* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ |
192 | command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *)); | 192 | command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *)); |
193 | command_line[0] = snmpcmd; | 193 | command_line[0] = snmpcmd; |
194 | command_line[1] = strdup ("-t"); | 194 | command_line[1] = strdup ("-t"); |
@@ -206,7 +206,7 @@ main (int argc, char **argv) | |||
206 | 206 | ||
207 | asprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port); | 207 | asprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port); |
208 | 208 | ||
209 | /* This is just for display purposes, so it can remain a string */ | 209 | /* This is just for display purposes, so it can remain a string */ |
210 | asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", | 210 | asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s", |
211 | snmpcmd, timeout_interval, retries, miblist, proto, "[authpriv]", | 211 | snmpcmd, timeout_interval, retries, miblist, proto, "[authpriv]", |
212 | server_address, port); | 212 | server_address, port); |
@@ -453,7 +453,7 @@ process_arguments (int argc, char **argv) | |||
453 | case 'p': /* TCP port number */ | 453 | case 'p': /* TCP port number */ |
454 | port = optarg; | 454 | port = optarg; |
455 | break; | 455 | break; |
456 | case 'm': /* List of MIBS */ | 456 | case 'm': /* List of MIBS */ |
457 | miblist = optarg; | 457 | miblist = optarg; |
458 | break; | 458 | break; |
459 | case 'n': /* usesnmpgetnext */ | 459 | case 'n': /* usesnmpgetnext */ |
@@ -666,7 +666,7 @@ validate_arguments () | |||
666 | { | 666 | { |
667 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ | 667 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ |
668 | if (miblist == NULL) { | 668 | if (miblist == NULL) { |
669 | if ( needmibs == TRUE ) { | 669 | if ( needmibs == TRUE ) { |
670 | miblist = strdup (DEFAULT_MIBLIST); | 670 | miblist = strdup (DEFAULT_MIBLIST); |
671 | }else{ | 671 | }else{ |
672 | miblist = "''"; /* don't read any mib files for numeric oids */ | 672 | miblist = "''"; /* don't read any mib files for numeric oids */ |
@@ -929,7 +929,7 @@ print_help (void) | |||
929 | 929 | ||
930 | printf ("%s\n", _("Check status of remote machines and obtain system information via SNMP")); | 930 | printf ("%s\n", _("Check status of remote machines and obtain system information via SNMP")); |
931 | 931 | ||
932 | printf ("\n\n"); | 932 | printf ("\n\n"); |
933 | 933 | ||
934 | print_usage (); | 934 | print_usage (); |
935 | 935 | ||
@@ -940,59 +940,59 @@ print_help (void) | |||
940 | 940 | ||
941 | /* SNMP and Authentication Protocol */ | 941 | /* SNMP and Authentication Protocol */ |
942 | printf (" %s\n", "-n, --next"); | 942 | printf (" %s\n", "-n, --next"); |
943 | printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET")); | 943 | printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET")); |
944 | printf (" %s\n", "-P, --protocol=[1|2c|3]"); | 944 | printf (" %s\n", "-P, --protocol=[1|2c|3]"); |
945 | printf (" %s\n", _("SNMP protocol version")); | 945 | printf (" %s\n", _("SNMP protocol version")); |
946 | printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); | 946 | printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]"); |
947 | printf (" %s\n", _("SNMPv3 securityLevel")); | 947 | printf (" %s\n", _("SNMPv3 securityLevel")); |
948 | printf (" %s\n", "-a, --authproto=[MD5|SHA]"); | 948 | printf (" %s\n", "-a, --authproto=[MD5|SHA]"); |
949 | printf (" %s\n", _("SNMPv3 auth proto")); | 949 | printf (" %s\n", _("SNMPv3 auth proto")); |
950 | printf (" %s\n", "-x, --privproto=[DES|AES]"); | 950 | printf (" %s\n", "-x, --privproto=[DES|AES]"); |
951 | printf (" %s\n", _("SNMPv3 priv proto (default DES)")); | 951 | printf (" %s\n", _("SNMPv3 priv proto (default DES)")); |
952 | 952 | ||
953 | /* Authentication Tokens*/ | 953 | /* Authentication Tokens*/ |
954 | printf (" %s\n", "-C, --community=STRING"); | 954 | printf (" %s\n", "-C, --community=STRING"); |
955 | printf (" %s ", _("Optional community string for SNMP communication")); | 955 | printf (" %s ", _("Optional community string for SNMP communication")); |
956 | printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY); | 956 | printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY); |
957 | printf (" %s\n", "-U, --secname=USERNAME"); | 957 | printf (" %s\n", "-U, --secname=USERNAME"); |
958 | printf (" %s\n", _("SNMPv3 username")); | 958 | printf (" %s\n", _("SNMPv3 username")); |
959 | printf (" %s\n", "-A, --authpassword=PASSWORD"); | 959 | printf (" %s\n", "-A, --authpassword=PASSWORD"); |
960 | printf (" %s\n", _("SNMPv3 authentication password")); | 960 | printf (" %s\n", _("SNMPv3 authentication password")); |
961 | printf (" %s\n", "-X, --privpasswd=PASSWORD"); | 961 | printf (" %s\n", "-X, --privpasswd=PASSWORD"); |
962 | printf (" %s\n", _("SNMPv3 privacy password")); | 962 | printf (" %s\n", _("SNMPv3 privacy password")); |
963 | 963 | ||
964 | /* OID Stuff */ | 964 | /* OID Stuff */ |
965 | printf (" %s\n", "-o, --oid=OID(s)"); | 965 | printf (" %s\n", "-o, --oid=OID(s)"); |
966 | printf (" %s\n", _("Object identifier(s) or SNMP variables whose value you wish to query")); | 966 | printf (" %s\n", _("Object identifier(s) or SNMP variables whose value you wish to query")); |
967 | printf (" %s\n", "-m, --miblist=STRING"); | 967 | printf (" %s\n", "-m, --miblist=STRING"); |
968 | printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'")); | 968 | printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'")); |
969 | printf (" %s\n", _("for symbolic OIDs.)")); | 969 | printf (" %s\n", _("for symbolic OIDs.)")); |
970 | printf (" %s\n", "-d, --delimiter=STRING"); | 970 | printf (" %s\n", "-d, --delimiter=STRING"); |
971 | printf (_(" Delimiter to use when parsing returned data. Default is \"%s\""), DEFAULT_DELIMITER); | 971 | printf (" %s \"%s\"\n", _("Delimiter to use when parsing returned data. Default is"), DEFAULT_DELIMITER); |
972 | printf (" %s\n", _("Any data on the right hand side of the delimiter is considered")); | 972 | printf (" %s\n", _("Any data on the right hand side of the delimiter is considered")); |
973 | printf (" %s\n", _("to be the data that should be used in the evaluation.")); | 973 | printf (" %s\n", _("to be the data that should be used in the evaluation.")); |
974 | 974 | ||
975 | /* Tests Against Integers */ | 975 | /* Tests Against Integers */ |
976 | printf (" %s\n", "-w, --warning=INTEGER_RANGE(s)"); | 976 | printf (" %s\n", "-w, --warning=INTEGER_RANGE(s)"); |
977 | printf (" %s\n", _("Range(s) which will not result in a WARNING status")); | 977 | printf (" %s\n", _("Range(s) which will not result in a WARNING status")); |
978 | printf (" %s\n", "-c, --critical=INTEGER_RANGE(s)"); | 978 | printf (" %s\n", "-c, --critical=INTEGER_RANGE(s)"); |
979 | printf (" %s\n", _("Range(s) which will not result in a CRITICAL status")); | 979 | printf (" %s\n", _("Range(s) which will not result in a CRITICAL status")); |
980 | 980 | ||
981 | /* Tests Against Strings */ | 981 | /* Tests Against Strings */ |
982 | printf (" %s\n", "-s, --string=STRING"); | 982 | printf (" %s\n", "-s, --string=STRING"); |
983 | printf (" %s\n", _("Return OK state (for that OID) if STRING is an exact match")); | 983 | printf (" %s\n", _("Return OK state (for that OID) if STRING is an exact match")); |
984 | printf (" %s\n", "-r, --ereg=REGEX"); | 984 | printf (" %s\n", "-r, --ereg=REGEX"); |
985 | printf (" %s\n", _("Return OK state (for that OID) if extended regular expression REGEX matches")); | 985 | printf (" %s\n", _("Return OK state (for that OID) if extended regular expression REGEX matches")); |
986 | printf (" %s\n", "-R, --eregi=REGEX"); | 986 | printf (" %s\n", "-R, --eregi=REGEX"); |
987 | printf (" %s\n", _("Return OK state (for that OID) if case-insensitive extended REGEX matches")); | 987 | printf (" %s\n", _("Return OK state (for that OID) if case-insensitive extended REGEX matches")); |
988 | printf (" %s\n", "-l, --label=STRING"); | 988 | printf (" %s\n", "-l, --label=STRING"); |
989 | printf (" %s\n", _("Prefix label for output from plugin (default -s 'SNMP')")); | 989 | printf (" %s\n", _("Prefix label for output from plugin (default -s 'SNMP')")); |
990 | 990 | ||
991 | /* Output Formatting */ | 991 | /* Output Formatting */ |
992 | printf (" %s\n", "-u, --units=STRING"); | 992 | printf (" %s\n", "-u, --units=STRING"); |
993 | printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.').")); | 993 | printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.').")); |
994 | printf (" %s\n", "-D, --output-delimiter=STRING"); | 994 | printf (" %s\n", "-D, --output-delimiter=STRING"); |
995 | printf (" %s\n", _("Separates output on multiple OID requests")); | 995 | printf (" %s\n", _("Separates output on multiple OID requests")); |
996 | 996 | ||
997 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 997 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
998 | printf (" %s\n", "-e, --retries=INTEGER"); | 998 | printf (" %s\n", "-e, --retries=INTEGER"); |
@@ -1000,32 +1000,32 @@ print_help (void) | |||
1000 | 1000 | ||
1001 | printf (_(UT_VERBOSE)); | 1001 | printf (_(UT_VERBOSE)); |
1002 | 1002 | ||
1003 | printf ("\n"); | 1003 | printf ("\n"); |
1004 | printf ("%s\n", _("This plugin uses the 'snmpget' command included with the NET-SNMP package.")); | 1004 | printf ("%s\n", _("This plugin uses the 'snmpget' command included with the NET-SNMP package.")); |
1005 | printf ("%s\n", _("if you don't have the package installed, you will need to download it from")); | 1005 | printf ("%s\n", _("if you don't have the package installed, you will need to download it from")); |
1006 | printf ("%s\n", _("http://net-snmp.sourceforge.net before you can use this plugin.")); | 1006 | printf ("%s\n", _("http://net-snmp.sourceforge.net before you can use this plugin.")); |
1007 | 1007 | ||
1008 | printf ("\n"); | 1008 | printf ("\n"); |
1009 | printf ("%s\n", _("Notes:")); | 1009 | printf ("%s\n", _("Notes:")); |
1010 | printf (" %s\n", _("- Multiple OIDs may be indicated by a comma- or space-delimited list (lists with")); | 1010 | printf (" %s\n", _("- Multiple OIDs may be indicated by a comma- or space-delimited list (lists with")); |
1011 | printf (" %s\n", _("internal spaces must be quoted) [max 8 OIDs]")); | 1011 | printf (" %s\n", _("internal spaces must be quoted) [max 8 OIDs]")); |
1012 | 1012 | ||
1013 | printf (" %s\n", _("- Ranges are inclusive and are indicated with colons. When specified as")); | 1013 | printf (" %s\n", _("- Ranges are inclusive and are indicated with colons. When specified as")); |
1014 | printf (" %s\n", _("'min:max' a STATE_OK will be returned if the result is within the indicated")); | 1014 | printf (" %s\n", _("'min:max' a STATE_OK will be returned if the result is within the indicated")); |
1015 | printf (" %s\n", _("range or is equal to the upper or lower bound. A non-OK state will be")); | 1015 | printf (" %s\n", _("range or is equal to the upper or lower bound. A non-OK state will be")); |
1016 | printf (" %s\n", _("returned if the result is outside the specified range.")); | 1016 | printf (" %s\n", _("returned if the result is outside the specified range.")); |
1017 | 1017 | ||
1018 | printf (" %s\n", _("- If specified in the order 'max:min' a non-OK state will be returned if the")); | 1018 | printf (" %s\n", _("- If specified in the order 'max:min' a non-OK state will be returned if the")); |
1019 | printf (" %s\n", _("result is within the (inclusive) range.")); | 1019 | printf (" %s\n", _("result is within the (inclusive) range.")); |
1020 | 1020 | ||
1021 | printf (" %s\n", _("- Upper or lower bounds may be omitted to skip checking the respective limit.")); | 1021 | printf (" %s\n", _("- Upper or lower bounds may be omitted to skip checking the respective limit.")); |
1022 | printf (" %s\n", _("- Bare integers are interpreted as upper limits.")); | 1022 | printf (" %s\n", _("- Bare integers are interpreted as upper limits.")); |
1023 | printf (" %s\n", _("- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'")); | 1023 | printf (" %s\n", _("- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'")); |
1024 | printf (" %s\n", _("- Note that only one string and one regex may be checked at present")); | 1024 | printf (" %s\n", _("- Note that only one string and one regex may be checked at present")); |
1025 | printf (" %s\n", _("- All evaluation methods other than PR, STR, and SUBSTR expect that the value")); | 1025 | printf (" %s\n", _("- All evaluation methods other than PR, STR, and SUBSTR expect that the value")); |
1026 | printf (" %s\n", _("returned from the SNMP query is an unsigned integer.")); | 1026 | printf (" %s\n", _("returned from the SNMP query is an unsigned integer.")); |
1027 | #ifdef NP_EXTRA_OPTS | 1027 | #ifdef NP_EXTRA_OPTS |
1028 | printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); | 1028 | printf (" -%s", _(UT_EXTRA_OPTS_NOTES)); |
1029 | #endif | 1029 | #endif |
1030 | 1030 | ||
1031 | printf (_(UT_SUPPORT)); | 1031 | printf (_(UT_SUPPORT)); |
@@ -1036,10 +1036,10 @@ print_help (void) | |||
1036 | void | 1036 | void |
1037 | print_usage (void) | 1037 | print_usage (void) |
1038 | { | 1038 | { |
1039 | printf (_("Usage:")); | 1039 | printf (_("Usage:")); |
1040 | printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); | 1040 | printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); |
1041 | printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); | 1041 | printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); |
1042 | printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); | 1042 | printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); |
1043 | printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); | 1043 | printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); |
1044 | printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n"); | 1044 | printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n"); |
1045 | } | 1045 | } |