summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 28cc44dd..da9638c4 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -41,7 +41,6 @@ const char *email = "devel@monitoring-plugins.org";
41#define DEFAULT_PORT "161" 41#define DEFAULT_PORT "161"
42#define DEFAULT_MIBLIST "ALL" 42#define DEFAULT_MIBLIST "ALL"
43#define DEFAULT_PROTOCOL "1" 43#define DEFAULT_PROTOCOL "1"
44#define DEFAULT_TIMEOUT 1
45#define DEFAULT_RETRIES 5 44#define DEFAULT_RETRIES 5
46#define DEFAULT_AUTH_PROTOCOL "MD5" 45#define DEFAULT_AUTH_PROTOCOL "MD5"
47#define DEFAULT_PRIV_PROTOCOL "DES" 46#define DEFAULT_PRIV_PROTOCOL "DES"
@@ -153,7 +152,7 @@ state_data *previous_state;
153double *previous_value; 152double *previous_value;
154size_t previous_size = OID_COUNT_STEP; 153size_t previous_size = OID_COUNT_STEP;
155int perf_labels = 1; 154int perf_labels = 1;
156 155char* ip_version = "";
157 156
158static char *fix_snmp_range(char *th) 157static char *fix_snmp_range(char *th)
159{ 158{
@@ -227,7 +226,7 @@ main (int argc, char **argv)
227 outbuff = strdup (""); 226 outbuff = strdup ("");
228 delimiter = strdup (" = "); 227 delimiter = strdup (" = ");
229 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); 228 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
230 timeout_interval = DEFAULT_TIMEOUT; 229 timeout_interval = DEFAULT_SOCKET_TIMEOUT;
231 retries = DEFAULT_RETRIES; 230 retries = DEFAULT_RETRIES;
232 231
233 np_init( (char *) progname, argc, argv ); 232 np_init( (char *) progname, argc, argv );
@@ -681,6 +680,8 @@ process_arguments (int argc, char **argv)
681 {"offset", required_argument, 0, L_OFFSET}, 680 {"offset", required_argument, 0, L_OFFSET},
682 {"invert-search", no_argument, 0, L_INVERT_SEARCH}, 681 {"invert-search", no_argument, 0, L_INVERT_SEARCH},
683 {"perf-oids", no_argument, 0, 'O'}, 682 {"perf-oids", no_argument, 0, 'O'},
683 {"ipv4", no_argument, 0, '4'},
684 {"ipv6", no_argument, 0, '6'},
684 {0, 0, 0, 0} 685 {0, 0, 0, 0}
685 }; 686 };
686 687
@@ -698,7 +699,7 @@ process_arguments (int argc, char **argv)
698 } 699 }
699 700
700 while (1) { 701 while (1) {
701 c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:", 702 c = getopt_long (argc, argv, "nhvVO46t:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
702 longopts, &option); 703 longopts, &option);
703 704
704 if (c == -1 || c == EOF) 705 if (c == -1 || c == EOF)
@@ -923,6 +924,13 @@ process_arguments (int argc, char **argv)
923 case 'O': 924 case 'O':
924 perf_labels=0; 925 perf_labels=0;
925 break; 926 break;
927 case '4':
928 break;
929 case '6':
930 xasprintf(&ip_version, "udp6:");
931 if(verbose>2)
932 printf("IPv6 detected! Will pass \"udp6:\" to snmpget.\n");
933 break;
926 } 934 }
927 } 935 }
928 936
@@ -1128,6 +1136,7 @@ print_help (void)
1128 1136
1129 printf (UT_HELP_VRSN); 1137 printf (UT_HELP_VRSN);
1130 printf (UT_EXTRA_OPTS); 1138 printf (UT_EXTRA_OPTS);
1139 printf (UT_IPv46);
1131 1140
1132 printf (UT_HOST_PORT, 'p', DEFAULT_PORT); 1141 printf (UT_HOST_PORT, 'p', DEFAULT_PORT);
1133 1142
@@ -1246,5 +1255,5 @@ print_usage (void)
1246 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); 1255 printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
1247 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); 1256 printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
1248 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n"); 1257 printf ("[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]\n");
1249 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]\n"); 1258 printf ("[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [-4|6]\n");
1250} 1259}