summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_fping.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 675a547..f4792f0 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -72,6 +72,7 @@ main (int argc, char **argv)
72/* normaly should be int result = STATE_UNKNOWN; */ 72/* normaly should be int result = STATE_UNKNOWN; */
73 73
74 int status = STATE_UNKNOWN; 74 int status = STATE_UNKNOWN;
75 char *fping_prog = NULL;
75 char *server = NULL; 76 char *server = NULL;
76 char *command_line = NULL; 77 char *command_line = NULL;
77 char *input_buffer = NULL; 78 char *input_buffer = NULL;
@@ -96,7 +97,16 @@ main (int argc, char **argv)
96 if (packet_interval) 97 if (packet_interval)
97 xasprintf(&option_string, "%s-p %d ", option_string, packet_interval); 98 xasprintf(&option_string, "%s-p %d ", option_string, packet_interval);
98 99
99 xasprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING, 100#ifdef USE_IPV6
101 if (address_family == AF_INET6)
102 fping_prog = strdup(PATH_TO_FPING6);
103 else
104 fping_prog = strdup(PATH_TO_FPING);
105#else
106 fping_prog = strdup(PATH_TO_FPING);
107#endif
108
109 xasprintf (&command_line, "%s %s-b %d -c %d %s", fping_prog,
100 option_string, packet_size, packet_count, server); 110 option_string, packet_size, packet_count, server);
101 111
102 if (verbose) 112 if (verbose)
@@ -241,6 +251,8 @@ process_arguments (int argc, char **argv)
241 {"verbose", no_argument, 0, 'v'}, 251 {"verbose", no_argument, 0, 'v'},
242 {"version", no_argument, 0, 'V'}, 252 {"version", no_argument, 0, 'V'},
243 {"help", no_argument, 0, 'h'}, 253 {"help", no_argument, 0, 'h'},
254 {"use-ipv4", no_argument, 0, '4'},
255 {"use-ipv6", no_argument, 0, '6'},
244 {0, 0, 0, 0} 256 {0, 0, 0, 0}
245 }; 257 };
246 258
@@ -258,7 +270,7 @@ process_arguments (int argc, char **argv)
258 } 270 }
259 271
260 while (1) { 272 while (1) {
261 c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option); 273 c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:46", longopts, &option);
262 274
263 if (c == -1 || c == EOF || c == 1) 275 if (c == -1 || c == EOF || c == 1)
264 break; 276 break;
@@ -281,6 +293,16 @@ process_arguments (int argc, char **argv)
281 } 293 }
282 server_name = strscpy (server_name, optarg); 294 server_name = strscpy (server_name, optarg);
283 break; 295 break;
296 case '4': /* IPv4 only */
297 address_family = AF_INET;
298 break;
299 case '6': /* IPv6 only */
300#ifdef USE_IPV6
301 address_family = AF_INET6;
302#else
303 usage (_("IPv6 support not available\n"));
304#endif
305 break;
284 case 'c': 306 case 'c':
285 get_threshold (optarg, rv); 307 get_threshold (optarg, rv);
286 if (rv[RTA]) { 308 if (rv[RTA]) {
@@ -402,6 +424,8 @@ print_help (void)
402 printf (UT_HELP_VRSN); 424 printf (UT_HELP_VRSN);
403 printf (UT_EXTRA_OPTS); 425 printf (UT_EXTRA_OPTS);
404 426
427 printf (UT_IPv46);
428
405 printf (" %s\n", "-H, --hostname=HOST"); 429 printf (" %s\n", "-H, --hostname=HOST");
406 printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)")); 430 printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
407 printf (" %s\n", "-w, --warning=THRESHOLD"); 431 printf (" %s\n", "-w, --warning=THRESHOLD");
@@ -422,6 +446,9 @@ print_help (void)
422 printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of")); 446 printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
423 printf (" %s\n", _("packet loss to trigger an alarm state.")); 447 printf (" %s\n", _("packet loss to trigger an alarm state."));
424 448
449 printf ("\n");
450 printf (" %s\n", _("IPv4 is used by default. Specify -6 to use IPv6."));
451
425 printf (UT_SUPPORT); 452 printf (UT_SUPPORT);
426} 453}
427 454