summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc03245)
raw | patch | inline | side by side (parent: cc03245)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sun, 1 Jun 2003 05:38:12 +0000 (05:38 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sun, 1 Jun 2003 05:38:12 +0000 (05:38 +0000) |
fix some doco (wait is now delay, server_quit was not shown)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@529 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@529 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_tcp.c | patch | blob | history |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 1057fdc66889f052c22e8781a7ba9a390696d66c..13c34f97a81472f93475adecddca09d51641fe0d 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
This plugin tests %s connections with the specified host.\n";
const char *option_summary = "\
--H host -p port [-w warn_time] [-c crit_time] [-s send]\n\
- [-e expect] [-W wait] [-t to_sec] [-r refuse_state] [-v]\n";
+-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
+ [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
+ [-t to_sec] [-r refuse_state] [-v]\n";
const char *options = "\
-H, --hostname=ADDRESS\n\
String to send to the server\n\
-e, --expect=STRING\n\
String to expect in server response\n\
- -W, --wait=INTEGER\n\
+ -q, --quit=STRING\n\
+ String to send server to initiate a clean close of the connection\n\
+ -m, --maxbytes=INTEGER\n\
+ Close connection once more than this number of bytes are received\n\
+ -d, --delay=INTEGER\n\
Seconds to wait between sending string and polling for response\n\
-w, --warning=DOUBLE\n\
Response time to result in warning status (seconds)\n\
Seconds before connection times out (default: %d)\n\
-r, --refuse=ok|warn|crit\n\
Accept tcp refusals with states ok, warn, crit (default: crit)\n\
- -v\n\
- Show details for command-line debugging (do not use with nagios server)\n";
+ -v, --verbose\n\
+ Show details for command-line debugging (Nagios may truncate output)\n";
const char *standard_options = "\
-h, --help\n\
char *server_quit = NULL;
char **server_expect = NULL;
int server_expect_count = 0;
+int maxbytes = 0;
char **warn_codes = NULL;
int warn_codes_count = 0;
char **crit_codes = NULL;
asprintf (&status, "%s%s", status, buffer);
if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
break;
+ if (maxbytes>0 && strlen(status)>maxbytes)
+ break;
}
/* return a CRITICAL status if we couldn't read any data */
{"port", required_argument, 0, 'p'},
{"send", required_argument, 0, 's'},
{"expect", required_argument, 0, 'e'},
+ {"maxbytes", required_argument, 0, 'm'},
{"quit", required_argument, 0, 'q'},
{"delay", required_argument, 0, 'd'},
{"refuse", required_argument, 0, 'r'},
}
while (1) {
- c = getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:Sr:", long_options,
- &option_index);
+ c = getopt_long (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:Sr:",
+ long_options, &option_index);
if (c == -1 || c == EOF || c == 1)
break;
server_expect = realloc (server_expect, ++server_expect_count);
server_expect[server_expect_count - 1] = optarg;
break;
+ case 'm':
+ if (!is_intpos (optarg))
+ usage ("Maxbytes must be a positive integer\n");
+ maxbytes = atoi (optarg);
case 'q':
server_quit = optarg;
break;