[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.21,1.22
Karl DeBisschop
kdebisschop at users.sourceforge.net
Sat May 31 22:39:06 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv6853
Modified Files:
check_tcp.c
Log Message:
allow user to limit number of bytes fetched
fix some doco (wait is now delay, server_quit was not shown)
Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** check_tcp.c 17 Apr 2003 05:55:25 -0000 1.21
--- check_tcp.c 1 Jun 2003 05:38:12 -0000 1.22
***************
*** 28,33 ****
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";
const char *options = "\
--- 28,34 ----
const char *option_summary = "\
! -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 = "\
***************
*** 41,45 ****
-e, --expect=STRING\n\
String to expect in server response\n\
! -W, --wait=INTEGER\n\
Seconds to wait between sending string and polling for response\n\
-w, --warning=DOUBLE\n\
--- 42,50 ----
-e, --expect=STRING\n\
String to expect in server response\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\
***************
*** 51,56 ****
-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";
const char *standard_options = "\
--- 56,61 ----
-r, --refuse=ok|warn|crit\n\
Accept tcp refusals with states ok, warn, crit (default: crit)\n\
! -v, --verbose\n\
! Show details for command-line debugging (Nagios may truncate output)\n";
const char *standard_options = "\
***************
*** 113,116 ****
--- 118,122 ----
char **server_expect = NULL;
int server_expect_count = 0;
+ int maxbytes = 0;
char **warn_codes = NULL;
int warn_codes_count = 0;
***************
*** 292,295 ****
--- 298,303 ----
if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
break;
+ if (maxbytes>0 && strlen(status)>maxbytes)
+ break;
}
***************
*** 381,384 ****
--- 389,393 ----
{"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'},
***************
*** 411,416 ****
while (1) {
! c = getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:Sr:", long_options,
! &option_index);
if (c == -1 || c == EOF || c == 1)
--- 420,425 ----
while (1) {
! 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)
***************
*** 477,480 ****
--- 486,493 ----
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;
More information about the Commits
mailing list