[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.8,1.9

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Oct 17 20:47:04 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv31114

Modified Files:
	check_http.c 
Log Message:
provide on more decimal point printing time

Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** check_http.c	16 Oct 2002 21:32:33 -0000	1.8
--- check_http.c	18 Oct 2002 03:46:10 -0000	1.9
***************
*** 208,212 ****
  void print_help (void);
  int process_arguments (int, char **);
- int call_getopt (int, char **);
  static char *base64 (char *bin, int len);
  int check_http (void);
--- 208,211 ----
***************
*** 277,281 ****
  	int option_index = 0;
  	static struct option long_options[] = {
! 		STD_OPTS_LONG,
  		{"link", no_argument, 0, 'L'},
  		{"nohtml", no_argument, 0, 'n'},
--- 276,281 ----
  	int option_index = 0;
  	static struct option long_options[] = {
! 		STD_LONG_OPTS,
! 		{"file",required_argument,0,'F'},
  		{"link", no_argument, 0, 'L'},
  		{"nohtml", no_argument, 0, 'n'},
***************
*** 310,321 ****
  	}
  
! 	snprintf (optchars, MAX_INPUT_BUFFER, "%s%s", STD_OPTS,
! 	          "P:I:a:e:p:s:R:r:u:f:C:nLS");
  
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c = getopt_long (argc, argv, optchars, long_options, &option_index);
  #else
! 		c = getopt (argc, argv, optchars);
  #endif
  		if (c == -1 || c == EOF)
--- 310,320 ----
  	}
  
! #define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nLS"
  
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index);
  #else
! 		c = getopt (argc, argv, OPTCHARS);
  #endif
  		if (c == -1 || c == EOF)
***************
*** 826,830 ****
  				printf ("HTTP CRITICAL");
  			elapsed_time = delta_time (tv);
! 			asprintf (&msg, ": %s - %6.2f second response time %s%s|time=%6.2f\n",
  		                 status_line, elapsed_time, timestamp,
  	                   (display_html ? "</A>" : ""), elapsed_time);
--- 825,829 ----
  				printf ("HTTP CRITICAL");
  			elapsed_time = delta_time (tv);
! 			asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n",
  		                 status_line, elapsed_time, timestamp,
  	                   (display_html ? "</A>" : ""), elapsed_time);
***************
*** 838,842 ****
  	/* check elapsed time */
  	elapsed_time = delta_time (tv);
! 	asprintf (&msg, "HTTP problem: %s - %6.2f second response time %s%s|time=%6.2f\n",
  	               status_line, elapsed_time, timestamp,
  	               (display_html ? "</A>" : ""), elapsed_time);
--- 837,841 ----
  	/* check elapsed time */
  	elapsed_time = delta_time (tv);
! 	asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n",
  	               status_line, elapsed_time, timestamp,
  	               (display_html ? "</A>" : ""), elapsed_time);
***************
*** 851,855 ****
  	if (strlen (string_expect)) {
  		if (strstr (page, string_expect)) {
! 			printf ("HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""), elapsed_time);
--- 850,854 ----
  	if (strlen (string_expect)) {
  		if (strstr (page, string_expect)) {
! 			printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""), elapsed_time);
***************
*** 857,861 ****
  		}
  		else {
! 			printf ("HTTP CRITICAL: string not found%s|time=%6.2f\n",
  			        (display_html ? "</A>" : ""), elapsed_time);
  			exit (STATE_CRITICAL);
--- 856,860 ----
  		}
  		else {
! 			printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n",
  			        (display_html ? "</A>" : ""), elapsed_time);
  			exit (STATE_CRITICAL);
***************
*** 866,870 ****
  		errcode = regexec (&preg, page, REGS, pmatch, 0);
  		if (errcode == 0) {
! 			printf ("HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""), elapsed_time);
--- 865,869 ----
  		errcode = regexec (&preg, page, REGS, pmatch, 0);
  		if (errcode == 0) {
! 			printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""), elapsed_time);
***************
*** 873,877 ****
  		else {
  			if (errcode == REG_NOMATCH) {
! 				printf ("HTTP CRITICAL: pattern not found%s|time=%6.2f\n",
  				        (display_html ? "</A>" : ""), elapsed_time);
  				exit (STATE_CRITICAL);
--- 872,876 ----
  		else {
  			if (errcode == REG_NOMATCH) {
! 				printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n",
  				        (display_html ? "</A>" : ""), elapsed_time);
  				exit (STATE_CRITICAL);
***************
*** 887,891 ****
  
  	/* We only get here if all tests have been passed */
! 	asprintf (&msg, "HTTP ok: %s - %6.2f second response time %s%s|time=%6.2f\n",
  	                status_line, (float)elapsed_time,
  	                timestamp, (display_html ? "</A>" : ""), elapsed_time);
--- 886,890 ----
  
  	/* 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",
  	                status_line, (float)elapsed_time,
  	                timestamp, (display_html ? "</A>" : ""), elapsed_time);





More information about the Commits mailing list