[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.13,1.13.2.1

Karl DeBisschop kdebisschop at users.sourceforge.net
Sat May 31 22:20:02 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv2908

Modified Files:
      Tag: r1_3_0
	check_tcp.c 
Log Message:
allow user to limit the number of bytes to be fetched


Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -r1.13 -r1.13.2.1
*** check_tcp.c	18 Feb 2003 22:20:01 -0000	1.13
--- check_tcp.c	1 Jun 2003 05:19:36 -0000	1.13.2.1
***************
*** 83,86 ****
--- 83,87 ----
  char **server_expect = NULL;
  int server_expect_count = 0;
+ int maxbytes = 0;
  char **warn_codes = NULL;
  int warn_codes_count = 0;
***************
*** 261,264 ****
--- 262,267 ----
  			if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
  				break;
+ 			if (maxbytes>0 && strlen(status)>maxbytes)
+ 				break;
  		}
  
***************
*** 348,351 ****
--- 351,355 ----
  		{"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'},
***************
*** 380,387 ****
  #ifdef HAVE_GETOPT_H
  		c =
! 			getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S", long_options,
  									 &option_index);
  #else
! 		c = getopt (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S");
  #endif
  
--- 384,391 ----
  #ifdef HAVE_GETOPT_H
  		c =
! 			getopt_long (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:S", long_options,
  									 &option_index);
  #else
! 		c = getopt (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:S");
  #endif
  
***************
*** 449,452 ****
--- 453,460 ----
  			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;
***************
*** 482,487 ****
  {
  	printf
! 		("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n"
! 		 "         [-e expect] [-W wait] [-t to_sec] [-v]\n", progname);
  }
  
--- 490,496 ----
  {
  	printf
! 		("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n"
! 		 "         [-e expect_string] [-q quit_string] [-m maxbytes] [-W wait]\n"
! 		 "         [-t to_sec] [-v]\n", progname);
  }
  
***************
*** 509,514 ****
  		 "    String to send to the server\n"
  		 " -e, --expect=STRING\n"
! 		 "    String to expect in server response"
! 		 " -W, --wait=INTEGER\n"
  		 "    Seconds to wait between sending string and polling for response\n"
  		 " -w, --warning=DOUBLE\n"
--- 518,527 ----
  		 "    String to send to the server\n"
  		 " -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"
***************
*** 526,529 ****
--- 539,548 ----
  }
  
+ /*
+ 		 " -W, --warning-codes=STRING\n"
+ 		 "    \n"
+ 		 " -C, --critical-code=STRING\n"
+ 		 "    \n"
+ */
  
  #ifdef HAVE_SSL





More information about the Commits mailing list