[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dns.c,1.10,1.11

Ton Voon tonvoon at users.sourceforge.net
Tue Mar 11 16:09:06 CET 2003


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

Modified Files:
	check_dns.c 
Log Message:
Timings in milliseconds and nicer output


Index: check_dns.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** check_dns.c	11 Mar 2003 22:22:09 -0000	1.10
--- check_dns.c	12 Mar 2003 00:08:19 -0000	1.11
***************
*** 76,79 ****
--- 76,82 ----
  	char *temp_buffer = NULL;
  	int result = STATE_UNKNOWN;
+ 	double elapsed_time;
+ 	struct timeval tv;
+ 	int multi_address;
  
  	/* Set signal handling and alarm */
***************
*** 92,96 ****
  
  	alarm (timeout_interval);
! 	time (&start_time);
  
  	if (verbose)
--- 95,99 ----
  
  	alarm (timeout_interval);
! 	gettimeofday (&tv, NULL);
  
  	if (verbose)
***************
*** 181,189 ****
  		}
  	
! 	(void) time (&end_time);
  
! 	if (result == STATE_OK)
! 		printf ("DNS ok - %d seconds response time, Address(es) is/are %s\n",
! 						(int) (end_time - start_time), address);
  	else if (result == STATE_WARNING)
  		printf ("DNS WARNING - %s\n",
--- 184,198 ----
  		}
  	
! 	elapsed_time = delta_time (tv);
  
! 	if (result == STATE_OK) {
! 		if (strchr (address, ',') == NULL)
! 			multi_address = FALSE;
! 		else
! 			multi_address = TRUE;
! 
! 		printf ("DNS ok - %-7.3f seconds response time, address%s %s|time=%-7.3f\n",
! 		  elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time);
! 	}
  	else if (result == STATE_WARNING)
  		printf ("DNS WARNING - %s\n",





More information about the Commits mailing list