[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dig.c,1.21,1.22

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Aug 26 04:22:53 CEST 2003


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

Modified Files:
	check_dig.c 
Log Message:
print perfdata

Index: check_dig.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** check_dig.c	23 Aug 2003 13:58:14 -0000	1.21
--- check_dig.c	26 Aug 2003 11:08:26 -0000	1.22
***************
*** 141,167 ****
  		asprintf (&output, _(" Probably a non-existent host/domain"));
  
! 	if (elapsed_time > critical_interval)
! 		die (STATE_CRITICAL,
! 		     _("DNS OK - %.3f seconds response time (%s)|time=%ldus\n"),
! 		     elapsed_time, output, microsec);
  
  	else if (result == STATE_CRITICAL)
! 		printf (_("DNS CRITICAL - %s|time=%ldus\n"), output, microsec);
  
! 	else if (elapsed_time > warning_interval)
! 		die (STATE_WARNING,
! 		     _("DNS OK - %.3f seconds response time (%s)|time=%ldus\n"),
! 		     elapsed_time, output, microsec);
  
  	else if (result == STATE_WARNING)
! 		printf (_("DNS WARNING - %s|time=%ldus\n"), output, microsec);
  
  	else if (result == STATE_OK)
! 		printf (_("DNS OK - %.3f seconds response time (%s)|time=%ldus\n"),
! 						elapsed_time, output, microsec);
  
  	else
! 		printf (_("DNS problem - %s|time=%ldus\n"), output, microsec);
  
  	return result;
  }
--- 141,170 ----
  		asprintf (&output, _(" Probably a non-existent host/domain"));
  
! 	if (critical_interval > 0 && elapsed_time > critical_interval)
! 		printf (_("DNS OK - %.3f seconds response time (%s)"), elapsed_time, output);
  
  	else if (result == STATE_CRITICAL)
! 		printf (_("DNS CRITICAL - %s"), output);
  
! 	else if (warning_interval > 0 && elapsed_time > warning_interval)
! 		printf (_("DNS OK - %.3f seconds response time (%s)"), elapsed_time, output);
  
  	else if (result == STATE_WARNING)
! 		printf (_("DNS WARNING - %s"), output);
  
  	else if (result == STATE_OK)
! 		printf (_("DNS OK - %.3f seconds response time (%s)"),
! 						elapsed_time, output);
  
  	else
! 		printf (_("DNS problem - %s"), output);
  
+ 	printf ("|%s\n",
+ 	        perfdata("time", microsec, "us",
+ 	                 (warning_interval>0?TRUE:FALSE),
+ 	                 (int)1e6*warning_interval,
+ 	                 (critical_interval>0?TRUE:FALSE),
+ 	                 (int)1e6*critical_interval,
+ 									 TRUE, 0, FALSE, 0));
  	return result;
  }
***************
*** 181,185 ****
  	static struct option longopts[] = {
  		{"hostname", required_argument, 0, 'H'},
! 		{"query_address", required_argument, 0, 'e'},
  		{"verbose", no_argument, 0, 'v'},
  		{"version", no_argument, 0, 'V'},
--- 184,191 ----
  	static struct option longopts[] = {
  		{"hostname", required_argument, 0, 'H'},
! 		{"query_address", required_argument, 0, 'l'},
! 		{"warning", required_argument, 0, 'w'},
! 		{"critical", required_argument, 0, 'c'},
! 		{"timeout", required_argument, 0, 't'},
  		{"verbose", no_argument, 0, 'v'},
  		{"version", no_argument, 0, 'V'},
***************
*** 192,196 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "hVvt:l:H:", longopts, &option);
  
  		if (c == -1 || c == EOF)
--- 198,202 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "hVvt:l:H:w:c:", longopts, &option);
  
  		if (c == -1 || c == EOF)
***************
*** 214,218 ****
  			}
  			break;
! 		case 'p':
  			if (is_intpos (optarg)) {
  				server_port = atoi (optarg);
--- 220,224 ----
  			}
  			break;
! 		case 'p':                 /* server port */
  			if (is_intpos (optarg)) {
  				server_port = atoi (optarg);
***************
*** 222,229 ****
  			}
  			break;
! 		case 'l':									/* username */
  			query_address = optarg;
  			break;
! 		case 'w':									/* timeout */
  			if (is_intnonneg (optarg)) {
  				warning_interval = atoi (optarg);
--- 228,235 ----
  			}
  			break;
! 		case 'l':									/* address to lookup */
  			query_address = optarg;
  			break;
! 		case 'w':									/* warning */
  			if (is_intnonneg (optarg)) {
  				warning_interval = atoi (optarg);
***************
*** 233,237 ****
  			}
  			break;
! 		case 'c':									/* timeout */
  			if (is_intnonneg (optarg)) {
  				critical_interval = atoi (optarg);
--- 239,243 ----
  			}
  			break;
! 		case 'c':									/* critical */
  			if (is_intnonneg (optarg)) {
  				critical_interval = atoi (optarg);





More information about the Commits mailing list