summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 2c3eceb..1c227cd 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -74,6 +74,7 @@ main (int argc, char **argv)
74/* normaly should be int result = STATE_UNKNOWN; */ 74/* normaly should be int result = STATE_UNKNOWN; */
75 75
76 int status = STATE_UNKNOWN; 76 int status = STATE_UNKNOWN;
77 char *fping_prog = NULL;
77 char *server = NULL; 78 char *server = NULL;
78 char *command_line = NULL; 79 char *command_line = NULL;
79 char *input_buffer = NULL; 80 char *input_buffer = NULL;
@@ -102,7 +103,16 @@ main (int argc, char **argv)
102 if (sourceif) 103 if (sourceif)
103 xasprintf(&option_string, "%s-I %s ", option_string, sourceif); 104 xasprintf(&option_string, "%s-I %s ", option_string, sourceif);
104 105
105 xasprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING, 106#ifdef USE_IPV6
107 if (address_family == AF_INET6)
108 fping_prog = strdup(PATH_TO_FPING6);
109 else
110 fping_prog = strdup(PATH_TO_FPING);
111#else
112 fping_prog = strdup(PATH_TO_FPING);
113#endif
114
115 xasprintf (&command_line, "%s %s-b %d -c %d %s", fping_prog,
106 option_string, packet_size, packet_count, server); 116 option_string, packet_size, packet_count, server);
107 117
108 if (verbose) 118 if (verbose)
@@ -249,6 +259,8 @@ process_arguments (int argc, char **argv)
249 {"verbose", no_argument, 0, 'v'}, 259 {"verbose", no_argument, 0, 'v'},
250 {"version", no_argument, 0, 'V'}, 260 {"version", no_argument, 0, 'V'},
251 {"help", no_argument, 0, 'h'}, 261 {"help", no_argument, 0, 'h'},
262 {"use-ipv4", no_argument, 0, '4'},
263 {"use-ipv6", no_argument, 0, '6'},
252 {0, 0, 0, 0} 264 {0, 0, 0, 0}
253 }; 265 };
254 266
@@ -266,7 +278,7 @@ process_arguments (int argc, char **argv)
266 } 278 }
267 279
268 while (1) { 280 while (1) {
269 c = getopt_long (argc, argv, "+hVvH:S:c:w:b:n:T:i:I:", longopts, &option); 281 c = getopt_long (argc, argv, "+hVvH:S:c:w:b:n:T:i:I:46", longopts, &option);
270 282
271 if (c == -1 || c == EOF || c == 1) 283 if (c == -1 || c == EOF || c == 1)
272 break; 284 break;
@@ -297,6 +309,15 @@ process_arguments (int argc, char **argv)
297 break; 309 break;
298 case 'I': /* sourceip */ 310 case 'I': /* sourceip */
299 sourceif = strscpy (sourceif, optarg); 311 sourceif = strscpy (sourceif, optarg);
312 case '4': /* IPv4 only */
313 address_family = AF_INET;
314 break;
315 case '6': /* IPv6 only */
316#ifdef USE_IPV6
317 address_family = AF_INET6;
318#else
319 usage (_("IPv6 support not available\n"));
320#endif
300 break; 321 break;
301 case 'c': 322 case 'c':
302 get_threshold (optarg, rv); 323 get_threshold (optarg, rv);
@@ -419,6 +440,8 @@ print_help (void)
419 printf (UT_HELP_VRSN); 440 printf (UT_HELP_VRSN);
420 printf (UT_EXTRA_OPTS); 441 printf (UT_EXTRA_OPTS);
421 442
443 printf (UT_IPv46);
444
422 printf (" %s\n", "-H, --hostname=HOST"); 445 printf (" %s\n", "-H, --hostname=HOST");
423 printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)")); 446 printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
424 printf (" %s\n", "-w, --warning=THRESHOLD"); 447 printf (" %s\n", "-w, --warning=THRESHOLD");
@@ -443,6 +466,9 @@ print_help (void)
443 printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of")); 466 printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
444 printf (" %s\n", _("packet loss to trigger an alarm state.")); 467 printf (" %s\n", _("packet loss to trigger an alarm state."));
445 468
469 printf ("\n");
470 printf (" %s\n", _("IPv4 is used by default. Specify -6 to use IPv6."));
471
446 printf (UT_SUPPORT); 472 printf (UT_SUPPORT);
447} 473}
448 474