diff options
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 675a547..f5b4332 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
@@ -52,6 +52,8 @@ void print_help (void); | |||
52 | void print_usage (void); | 52 | void print_usage (void); |
53 | 53 | ||
54 | char *server_name = NULL; | 54 | char *server_name = NULL; |
55 | char *sourceip = NULL; | ||
56 | char *sourceif = NULL; | ||
55 | int packet_size = PACKET_SIZE; | 57 | int packet_size = PACKET_SIZE; |
56 | int packet_count = PACKET_COUNT; | 58 | int packet_count = PACKET_COUNT; |
57 | int target_timeout = 0; | 59 | int target_timeout = 0; |
@@ -95,6 +97,10 @@ main (int argc, char **argv) | |||
95 | xasprintf(&option_string, "%s-t %d ", option_string, target_timeout); | 97 | xasprintf(&option_string, "%s-t %d ", option_string, target_timeout); |
96 | if (packet_interval) | 98 | if (packet_interval) |
97 | xasprintf(&option_string, "%s-p %d ", option_string, packet_interval); | 99 | xasprintf(&option_string, "%s-p %d ", option_string, packet_interval); |
100 | if (sourceip) | ||
101 | xasprintf(&option_string, "%s-S %s ", option_string, sourceip); | ||
102 | if (sourceif) | ||
103 | xasprintf(&option_string, "%s-I %s ", option_string, sourceif); | ||
98 | 104 | ||
99 | xasprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING, | 105 | xasprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING, |
100 | option_string, packet_size, packet_count, server); | 106 | option_string, packet_size, packet_count, server); |
@@ -232,6 +238,8 @@ process_arguments (int argc, char **argv) | |||
232 | int option = 0; | 238 | int option = 0; |
233 | static struct option longopts[] = { | 239 | static struct option longopts[] = { |
234 | {"hostname", required_argument, 0, 'H'}, | 240 | {"hostname", required_argument, 0, 'H'}, |
241 | {"sourceip", required_argument, 0, 'S'}, | ||
242 | {"sourceif", required_argument, 0, 'I'}, | ||
235 | {"critical", required_argument, 0, 'c'}, | 243 | {"critical", required_argument, 0, 'c'}, |
236 | {"warning", required_argument, 0, 'w'}, | 244 | {"warning", required_argument, 0, 'w'}, |
237 | {"bytes", required_argument, 0, 'b'}, | 245 | {"bytes", required_argument, 0, 'b'}, |
@@ -258,7 +266,7 @@ process_arguments (int argc, char **argv) | |||
258 | } | 266 | } |
259 | 267 | ||
260 | while (1) { | 268 | while (1) { |
261 | c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option); | 269 | c = getopt_long (argc, argv, "+hVvH:S:c:w:b:n:T:i:I:", longopts, &option); |
262 | 270 | ||
263 | if (c == -1 || c == EOF || c == 1) | 271 | if (c == -1 || c == EOF || c == 1) |
264 | break; | 272 | break; |
@@ -281,6 +289,15 @@ process_arguments (int argc, char **argv) | |||
281 | } | 289 | } |
282 | server_name = strscpy (server_name, optarg); | 290 | server_name = strscpy (server_name, optarg); |
283 | break; | 291 | break; |
292 | case 'S': /* sourceip */ | ||
293 | if (is_host (optarg) == FALSE) { | ||
294 | usage2 (_("Invalid hostname/address"), optarg); | ||
295 | } | ||
296 | sourceip = strscpy (sourceip, optarg); | ||
297 | break; | ||
298 | case 'I': /* sourceip */ | ||
299 | sourceif = strscpy (sourceif, optarg); | ||
300 | break; | ||
284 | case 'c': | 301 | case 'c': |
285 | get_threshold (optarg, rv); | 302 | get_threshold (optarg, rv); |
286 | if (rv[RTA]) { | 303 | if (rv[RTA]) { |
@@ -416,6 +433,10 @@ print_help (void) | |||
416 | printf (" %s (default: fping's default for -t)\n", _("Target timeout (ms)"),PACKET_COUNT); | 433 | printf (" %s (default: fping's default for -t)\n", _("Target timeout (ms)"),PACKET_COUNT); |
417 | printf (" %s\n", "-i, --interval=INTEGER"); | 434 | printf (" %s\n", "-i, --interval=INTEGER"); |
418 | printf (" %s (default: fping's default for -p)\n", _("Interval (ms) between sending packets"),PACKET_COUNT); | 435 | printf (" %s (default: fping's default for -p)\n", _("Interval (ms) between sending packets"),PACKET_COUNT); |
436 | printf (" %s\n", "-S, --sourceip=HOST"); | ||
437 | printf (" %s\n", _("name or IP Address of sourceip")); | ||
438 | printf (" %s\n", "-I, --sourceif=IF"); | ||
439 | printf (" %s\n", _("source interface name")); | ||
419 | printf (UT_VERBOSE); | 440 | printf (UT_VERBOSE); |
420 | printf ("\n"); | 441 | printf ("\n"); |
421 | printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)")); | 442 | printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)")); |