[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.27,1.28

Jeremy T. Bouse undrgrid at users.sourceforge.net
Tue Mar 11 18:30:06 CET 2003


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

Modified Files:
	check_http.c 
Log Message:
Clean up of output from plugin


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** check_http.c	12 Mar 2003 02:25:57 -0000	1.27
--- check_http.c	12 Mar 2003 02:29:15 -0000	1.28
***************
*** 782,786 ****
  					pos += (size_t) strspn (pos, "\r\n");
  				} /* end while (pos) */
! 				printf ("HTTP UNKNOWN: Could not find redirect location - %s%s",
  				        status_line, (display_html ? "</A>" : ""));
  				exit (STATE_UNKNOWN);
--- 782,786 ----
  					pos += (size_t) strspn (pos, "\r\n");
  				} /* end while (pos) */
! 				printf ("UNKNOWN - Could not find redirect location - %s%s",
  				        status_line, (display_html ? "</A>" : ""));
  				exit (STATE_UNKNOWN);
***************
*** 788,800 ****
  			
  			else if (onredirect == STATE_UNKNOWN)
! 				printf ("HTTP UNKNOWN");
  			else if (onredirect == STATE_OK)
! 				printf ("HTTP ok");
  			else if (onredirect == STATE_WARNING)
! 				printf ("HTTP WARNING");
  			else if (onredirect == STATE_CRITICAL)
! 				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);
--- 788,800 ----
  			
  			else if (onredirect == STATE_UNKNOWN)
! 				printf ("UNKNOWN");
  			else if (onredirect == STATE_OK)
! 				printf ("OK");
  			else if (onredirect == STATE_WARNING)
! 				printf ("WARNING");
  			else if (onredirect == STATE_CRITICAL)
! 				printf ("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);
***************
*** 827,831 ****
  		}
  		else {
! 			printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n",
  			        (display_html ? "</A>" : ""), elapsed_time);
  			exit (STATE_CRITICAL);
--- 827,831 ----
  		}
  		else {
! 			printf ("CRITICAL - string not found%s|time=%7.3f\n",
  			        (display_html ? "</A>" : ""), elapsed_time);
  			exit (STATE_CRITICAL);
***************
*** 843,847 ****
  		else {
  			if (errcode == REG_NOMATCH) {
! 				printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n",
  				        (display_html ? "</A>" : ""), elapsed_time);
  				exit (STATE_CRITICAL);
--- 843,847 ----
  		else {
  			if (errcode == REG_NOMATCH) {
! 				printf ("CRITICAL - pattern not found%s|time=%7.3f\n",
  				        (display_html ? "</A>" : ""), elapsed_time);
  				exit (STATE_CRITICAL);
***************
*** 849,853 ****
  			else {
  				regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
! 				printf ("Execute Error: %s\n", errbuf);
  				exit (STATE_CRITICAL);
  			}
--- 849,853 ----
  			else {
  				regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
! 				printf ("CRITICAL - Execute Error: %s\n", errbuf);
  				exit (STATE_CRITICAL);
  			}
***************
*** 888,892 ****
  	SSL_load_error_strings ();
  	if ((ctx = SSL_CTX_new (meth)) == NULL) {
! 		printf ("ERROR: Cannot create SSL context.\n");
  		return STATE_CRITICAL;
  	}
--- 888,892 ----
  	SSL_load_error_strings ();
  	if ((ctx = SSL_CTX_new (meth)) == NULL) {
! 		printf ("CRITICAL -  Cannot create SSL context.\n");
  		return STATE_CRITICAL;
  	}
***************
*** 912,916 ****
  		}
  		else {
! 			printf ("ERROR: Cannot initiate SSL handshake.\n");
  		}
  		SSL_free (ssl);
--- 912,916 ----
  		}
  		else {
! 			printf ("CRITICAL - Cannot initiate SSL handshake.\n");
  		}
  		SSL_free (ssl);
***************
*** 940,944 ****
  	if (tm->type == V_ASN1_UTCTIME) {
  		if (tm->length < 10) {
! 			printf ("ERROR: Wrong time format in certificate.\n");
  			return STATE_CRITICAL;
  		}
--- 940,944 ----
  	if (tm->type == V_ASN1_UTCTIME) {
  		if (tm->length < 10) {
! 			printf ("CRITICAL - Wrong time format in certificate.\n");
  			return STATE_CRITICAL;
  		}
***************
*** 952,956 ****
  	else {
  		if (tm->length < 12) {
! 			printf ("ERROR: Wrong time format in certificate.\n");
  			return STATE_CRITICAL;
  		}
--- 952,956 ----
  	else {
  		if (tm->length < 12) {
! 			printf ("CRITICAL - Wrong time format in certificate.\n");
  			return STATE_CRITICAL;
  		}
***************
*** 981,998 ****
  
  	if (days_left > 0 && days_left <= days_till_exp) {
! 		printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp);
  		return STATE_WARNING;
  	}
  	if (days_left < 0) {
! 		printf ("Certificate expired on %s.\n", timestamp);
  		return STATE_CRITICAL;
  	}
  
  	if (days_left == 0) {
! 		printf ("Certificate expires today (%s).\n", timestamp);
  		return STATE_WARNING;
  	}
  
! 	printf ("Certificate will expire on %s.\n", timestamp);
  
  	return STATE_OK;
--- 981,998 ----
  
  	if (days_left > 0 && days_left <= days_till_exp) {
! 		printf ("WARNING - Certificate expires in %d day(s) (%s).\n", days_left, timestamp);
  		return STATE_WARNING;
  	}
  	if (days_left < 0) {
! 		printf ("CRITICAL - Certificate expired on %s.\n", timestamp);
  		return STATE_CRITICAL;
  	}
  
  	if (days_left == 0) {
! 		printf ("WARNING - Certificate expires today (%s).\n", timestamp);
  		return STATE_WARNING;
  	}
  
! 	printf ("OK - Certificate will expire on %s.\n", timestamp);
  
  	return STATE_OK;





More information about the Commits mailing list