diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2004-11-17 23:35:08 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2004-11-17 23:35:08 (GMT) |
commit | 10155cdd167cf7555717af4c3d450d4b44dae67a (patch) | |
tree | 75e0e64b19dc7bfca036ed2e08ea18b53ad8fc1b | |
parent | d56c17f1bedf5564ce7f13993ec026617fbaf51e (diff) | |
download | monitoring-plugins-10155cdd167cf7555717af4c3d450d4b44dae67a.tar.gz |
Ignore output from tcp port (949070 - Jan-Piet Mens)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@899 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/check_tcp.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 9bb161a..6f2aa03 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -84,6 +84,7 @@ double warning_time = 0; | |||
84 | int check_warning_time = FALSE; | 84 | int check_warning_time = FALSE; |
85 | double critical_time = 0; | 85 | double critical_time = 0; |
86 | int check_critical_time = FALSE; | 86 | int check_critical_time = FALSE; |
87 | int hide_output = FALSE; | ||
87 | double elapsed_time = 0; | 88 | double elapsed_time = 0; |
88 | long microsec; | 89 | long microsec; |
89 | int verbose = FALSE; | 90 | int verbose = FALSE; |
@@ -329,7 +330,7 @@ main (int argc, char **argv) | |||
329 | (was_refused) ? " (refused)" : "", | 330 | (was_refused) ? " (refused)" : "", |
330 | elapsed_time, server_port); | 331 | elapsed_time, server_port); |
331 | 332 | ||
332 | if (status && strlen(status) > 0) | 333 | if (hide_output == FALSE && status && strlen(status) > 0) |
333 | printf (" [%s]", status); | 334 | printf (" [%s]", status); |
334 | 335 | ||
335 | printf (" |%s\n", fperfdata ("time", elapsed_time, "s", | 336 | printf (" |%s\n", fperfdata ("time", elapsed_time, "s", |
@@ -364,6 +365,7 @@ process_arguments (int argc, char **argv) | |||
364 | {"expect", required_argument, 0, 'e'}, | 365 | {"expect", required_argument, 0, 'e'}, |
365 | {"maxbytes", required_argument, 0, 'm'}, | 366 | {"maxbytes", required_argument, 0, 'm'}, |
366 | {"quit", required_argument, 0, 'q'}, | 367 | {"quit", required_argument, 0, 'q'}, |
368 | {"jail", required_argument, 0, 'j'}, | ||
367 | {"delay", required_argument, 0, 'd'}, | 369 | {"delay", required_argument, 0, 'd'}, |
368 | {"refuse", required_argument, 0, 'r'}, | 370 | {"refuse", required_argument, 0, 'r'}, |
369 | {"use-ipv4", no_argument, 0, '4'}, | 371 | {"use-ipv4", no_argument, 0, '4'}, |
@@ -395,7 +397,7 @@ process_arguments (int argc, char **argv) | |||
395 | } | 397 | } |
396 | 398 | ||
397 | while (1) { | 399 | while (1) { |
398 | c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:", | 400 | c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:j", |
399 | longopts, &option); | 401 | longopts, &option); |
400 | 402 | ||
401 | if (c == -1 || c == EOF || c == 1) | 403 | if (c == -1 || c == EOF || c == 1) |
@@ -437,6 +439,9 @@ process_arguments (int argc, char **argv) | |||
437 | critical_time = strtod (optarg, NULL); | 439 | critical_time = strtod (optarg, NULL); |
438 | check_critical_time = TRUE; | 440 | check_critical_time = TRUE; |
439 | break; | 441 | break; |
442 | case 'j': /* hide output */ | ||
443 | hide_output = TRUE; | ||
444 | break; | ||
440 | case 'w': /* warning */ | 445 | case 'w': /* warning */ |
441 | if (!is_intnonneg (optarg)) | 446 | if (!is_intnonneg (optarg)) |
442 | usage (_("Warning threshold must be a nonnegative integer\n")); | 447 | usage (_("Warning threshold must be a nonnegative integer\n")); |
@@ -622,6 +627,8 @@ print_help (void) | |||
622 | printf (_("\ | 627 | printf (_("\ |
623 | -r, --refuse=ok|warn|crit\n\ | 628 | -r, --refuse=ok|warn|crit\n\ |
624 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ | 629 | Accept tcp refusals with states ok, warn, crit (default: crit)\n\ |
630 | -j, --jail\n\ | ||
631 | Hide output from TCP socket\n\ | ||
625 | -m, --maxbytes=INTEGER\n\ | 632 | -m, --maxbytes=INTEGER\n\ |
626 | Close connection once more than this number of bytes are received\n\ | 633 | Close connection once more than this number of bytes are received\n\ |
627 | -d, --delay=INTEGER\n\ | 634 | -d, --delay=INTEGER\n\ |
@@ -646,7 +653,7 @@ print_usage (void) | |||
646 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | 653 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ |
647 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | 654 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ |
648 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | 655 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ |
649 | [-r <refuse state>] [-v] [-4|-6]\n"), progname); | 656 | [-r <refuse state>] [-v] [-4|-6] [-j]\n"), progname); |
650 | printf (" %s (-h|--help)\n", progname); | 657 | printf (" %s (-h|--help)\n", progname); |
651 | printf (" %s (-V|--version)\n", progname); | 658 | printf (" %s (-V|--version)\n", progname); |
652 | } | 659 | } |