[Nagiosplug-checkins] CVS: nagiosplug/plugins check_time.c,1.11,1.12

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Nov 18 22:25:02 CET 2003


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

Modified Files:
	check_time.c 
Log Message:
add perfdata


Index: check_time.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_time.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** check_time.c	22 Aug 2003 06:22:38 -0000	1.11
--- check_time.c	19 Nov 2003 06:24:08 -0000	1.12
***************
*** 55,58 ****
--- 55,59 ----
  	int sd;
  	int result;
+ 	time_t conntime;
  
  	setlocale (LC_ALL, "");
***************
*** 128,139 ****
  	result = STATE_OK;
  
! 	if (check_critical_time == TRUE && (end_time - start_time) > critical_time)
  		result = STATE_CRITICAL;
! 	else if (check_warning_time == TRUE
! 					 && (end_time - start_time) > warning_time) result = STATE_WARNING;
  
  	if (result != STATE_OK)
! 		die (result, _("TIME %s - %d second response time\n"),
! 							 state_text (result), (int) (end_time - start_time));
  
  	server_time = ntohl (raw_server_time) - UNIX_EPOCH;
--- 129,145 ----
  	result = STATE_OK;
  
! 	conntime = (end_time - start_time);
! 	if (check_critical_time == TRUE && conntime > critical_time)
  		result = STATE_CRITICAL;
! 	else if (check_warning_time == TRUE && conntime > warning_time)
! 		result = STATE_WARNING;
  
  	if (result != STATE_OK)
! 		die (result, _("TIME %s - %d second response time|%s\n"),
! 		     state_text (result), (int)conntime,
! 		     perfdata ("time", (long)conntime, "s",
! 		               check_warning_time, (long)warning_time,
! 		               check_critical_time, (long)critical_time,
! 		               TRUE, 0, FALSE, 0));
  
  	server_time = ntohl (raw_server_time) - UNIX_EPOCH;
***************
*** 148,153 ****
  		result = STATE_WARNING;
  
! 	printf (_("TIME %s - %lu second time difference\n"), state_text (result),
! 					diff_time);
  	return result;
  }
--- 154,167 ----
  		result = STATE_WARNING;
  
! 	printf (_("TIME %s - %lu second time difference|%s %s\n"),
! 	        state_text (result), diff_time,
! 	        perfdata ("time", (long)conntime, "s",
! 	                  check_warning_time, (long)warning_time,
! 	                  check_critical_time, (long)critical_time,
! 	                  TRUE, 0, FALSE, 0),
! 	        perfdata ("offset", (long)diff_time, "s",
! 	                  check_warning_diff, (long)warning_diff,
! 	                  check_critical_diff, (long)critical_diff,
! 	                  TRUE, 0, FALSE, 0));
  	return result;
  }





More information about the Commits mailing list