[Nagiosplug-checkins] CVS: nagiosplug/plugins utils.c,1.36,1.37 check_http.c,1.58,1.59

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Mar 3 04:46:07 CET 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3516/plugins

Modified Files:
	utils.c check_http.c 
Log Message:
begin writing some perfdata as float

Index: utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** utils.c	20 Feb 2004 05:21:21 -0000	1.36
--- utils.c	3 Mar 2004 12:33:15 -0000	1.37
***************
*** 562,584 ****
  
  	if (strpbrk (label, "'= "))
! 		asprintf (&data, "'%s'=%ld%s;", label, val, uom);
  	else
! 		asprintf (&data, "%s=%ld%s;", label, val, uom);
  
  	if (warnp)
! 		asprintf (&data, "%s%ld;", data, warn);
! 	else
! 		asprintf (&data, "%s;", data);
  
  	if (critp)
! 		asprintf (&data, "%s%ld;", data, crit);
! 	else
! 		asprintf (&data, "%s;", data);
  
  	if (minp)
! 		asprintf (&data, "%s%ld", data, minv);
  
! 	if (maxp)
! 		asprintf (&data, "%s;%ld", data, maxv);
  
  	return data;
--- 562,589 ----
  
  	if (strpbrk (label, "'= "))
! 		asprintf (&data, "'%s'=", label);
  	else
! 		asprintf (&data, "%s=", label);
! 
! 	asprintf (&data, "%s%f", data, val);
! 	asprintf (&data, "%s%s;", data, uom);
  
  	if (warnp)
! 		asprintf (&data, "%s%f", data, warn);
! 
! 	asprintf (&data, "%s;", data);
  
  	if (critp)
! 		asprintf (&data, "%s%f", data, crit);
! 
! 	asprintf (&data, "%s;", data);
  
  	if (minp)
! 		asprintf (&data, "%s%f", data, minv);
  
! 	if (maxp) {
! 		asprintf (&data, "%s;", data);
! 		asprintf (&data, "%s%f", data, maxv);
! 	}
  
  	return data;

Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -r1.58 -r1.59
*** check_http.c	2 Mar 2004 05:25:33 -0000	1.58
--- check_http.c	3 Mar 2004 12:33:15 -0000	1.59
***************
*** 121,125 ****
  int server_type_check(const char *type);
  int server_port_check(int ssl_flag);
! char *perfd_time (long microsec);
  char *perfd_size (int page_len);
  int my_recv (void);
--- 121,125 ----
  int server_type_check(const char *type);
  int server_port_check(int ssl_flag);
! char *perfd_time (double microsec);
  char *perfd_size (int page_len);
  int my_recv (void);
***************
*** 686,690 ****
  			     status_line, elapsed_time, timestamp,
  			     (display_html ? "</A>" : ""),
! 					 perfd_time (microsec), perfd_size (pagesize));
  		} /* end if (http_status >= 300) */
  
--- 686,690 ----
  			     status_line, elapsed_time, timestamp,
  			     (display_html ? "</A>" : ""),
! 					 perfd_time (elapsed_time), perfd_size (pagesize));
  		} /* end if (http_status >= 300) */
  
***************
*** 698,702 ****
  	          status_line, elapsed_time, timestamp,
  	          (display_html ? "</A>" : ""),
! 						perfd_time (microsec), perfd_size (pagesize));
  	if (check_critical_time == TRUE && elapsed_time > critical_time)
  		die (STATE_CRITICAL, "%s", msg);
--- 698,702 ----
  	          status_line, elapsed_time, timestamp,
  	          (display_html ? "</A>" : ""),
! 						perfd_time (elapsed_time), perfd_size (pagesize));
  	if (check_critical_time == TRUE && elapsed_time > critical_time)
  		die (STATE_CRITICAL, "%s", msg);
***************
*** 712,716 ****
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""),
! 			        perfd_time (microsec), perfd_size (pagesize));
  			exit (STATE_OK);
  		}
--- 712,716 ----
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""),
! 			        perfd_time (elapsed_time), perfd_size (pagesize));
  			exit (STATE_OK);
  		}
***************
*** 718,722 ****
  			printf (_("CRITICAL - string not found%s|%s %s\n"),
  			        (display_html ? "</A>" : ""),
! 			        perfd_time (microsec), perfd_size (pagesize));
  			exit (STATE_CRITICAL);
  		}
--- 718,722 ----
  			printf (_("CRITICAL - string not found%s|%s %s\n"),
  			        (display_html ? "</A>" : ""),
! 			        perfd_time (elapsed_time), perfd_size (pagesize));
  			exit (STATE_CRITICAL);
  		}
***************
*** 729,733 ****
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""),
! 			        perfd_time (microsec), perfd_size (pagesize));
  			exit (STATE_OK);
  		}
--- 729,733 ----
  			        status_line, elapsed_time,
  			        timestamp, (display_html ? "</A>" : ""),
! 			        perfd_time (elapsed_time), perfd_size (pagesize));
  			exit (STATE_OK);
  		}
***************
*** 736,740 ****
  				printf (_("CRITICAL - pattern not found%s|%s %s\n"),
  				        (display_html ? "</A>" : ""),
! 				        perfd_time (microsec), perfd_size (pagesize));
  				exit (STATE_CRITICAL);
  			}
--- 736,740 ----
  				printf (_("CRITICAL - pattern not found%s|%s %s\n"),
  				        (display_html ? "</A>" : ""),
! 				        perfd_time (elapsed_time), perfd_size (pagesize));
  				exit (STATE_CRITICAL);
  			}
***************
*** 759,763 ****
  	          status_line, page_len, elapsed_time,
  	          timestamp, (display_html ? "</A>" : ""),
! 						perfd_time (microsec), perfd_size (page_len));
  	die (STATE_OK, "%s", msg);
  	return STATE_UNKNOWN;
--- 759,763 ----
  	          status_line, page_len, elapsed_time,
  	          timestamp, (display_html ? "</A>" : ""),
! 						perfd_time (elapsed_time), perfd_size (page_len));
  	die (STATE_OK, "%s", msg);
  	return STATE_UNKNOWN;
***************
*** 1046,1055 ****
  
  
! char *perfd_time (long microsec)
  {
! 	return perfdata ("time", microsec, "us",
! 	          check_warning_time, (int)(1e6*warning_time),
! 	          check_critical_time, (int)(1e6*critical_time),
! 	          TRUE, 0, FALSE, 0);
  }
  
--- 1046,1055 ----
  
  
! char *perfd_time (double elapsed_time)
  {
! 	return fperfdata ("time", elapsed_time, "s",
! 	          check_warning_time, warning_time,
! 	          check_critical_time, critical_time,
! 									 TRUE, 0, FALSE, 0);
  }
  





More information about the Commits mailing list