[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.24,1.25

Ton Voon tonvoon at users.sourceforge.net
Tue Mar 4 16:18:27 CET 2003


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

Modified Files:
	check_http.c 
Log Message:
check_http min size option (680467 - Dave Viner)


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** check_http.c	21 Feb 2003 21:59:17 -0000	1.24
--- check_http.c	5 Mar 2003 00:17:15 -0000	1.25
***************
*** 46,50 ****
              [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
              [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
!             [-P string]"
  
  #define LONGOPTIONS "\
--- 46,50 ----
              [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
              [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
!             [-P string] [-m min_pg_size]"
  
  #define LONGOPTIONS "\
***************
*** 76,79 ****
--- 76,81 ----
   -f, --onredirect=<ok|warning|critical|follow>\n\
     How to handle redirected pages\n%s%s\
+ -m, --min=INTEGER\n\
+    Minimum page size required (bytes)\n\
   -v, --verbose\n\
      Show details for command-line debugging (do not use with nagios server)\n\
***************
*** 219,222 ****
--- 221,225 ----
  int verbose = FALSE;
  int sd;
+ int min_page_len = 0;
  char *http_method = "GET";
  char *http_post_data = "";
***************
*** 312,315 ****
--- 315,319 ----
  		{"onredirect", required_argument, 0, 'f'},
  		{"certificate", required_argument, 0, 'C'},
+ 		{"min", required_argument, 0, 'm'},
  		{0, 0, 0, 0}
  	};
***************
*** 332,336 ****
  	}
  
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"
  
  	while (1) {
--- 336,340 ----
  	}
  
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:"
  
  	while (1) {
***************
*** 470,473 ****
--- 474,480 ----
  			verbose = TRUE;
  			break;
+ 		case 'm': /* min_page_length */
+ 			min_page_len = atoi (optarg);
+ 			break;
  		}
  	}
***************
*** 551,554 ****
--- 558,562 ----
  	char *orig_url = NULL;
  	double elapsed_time;
+ 	int page_len = 0;
  #ifdef HAVE_SSL
  	int sslerr;
***************
*** 856,859 ****
--- 864,874 ----
  #endif
  
+ 	/* make sure the page is of an appropriate size */
+ 	page_len = strlen (page);
+ 	if ((min_page_len > 0) && (page_len < min_page_len)) {
+ 		printf ("HTTP WARNING: page size too small%s|size=%i\n",
+ 			(display_html ? "</A>" : ""), page_len );
+ 		exit (STATE_WARNING);
+ 	}
  	/* We only get here if all tests have been passed */
  	asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",





More information about the Commits mailing list