[Nagiosplug-devel] check_smtp patch against 1.3.1

Jason Martin jhmartin at toger.us
Tue Jun 1 09:36:05 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patch against the 1.3.1 release does the following:

> * Revision:
> *  Jason Martin <jhmartin at toger.us>
> *  Handle non-integer time thresholds
> *

It requires the is_numnonneg function from the check_tcp patch I 
submitted earlier.


- -Jason Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.5 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/

iD8DBQFAvK9il2ODWuqVSBMRAoobAJ0byGWKe0vcRLJLzi5D7jHCfoWmaQCfRWYg
jn63LebXnaLPob/hGHf7VvQ=
=YGMd
-----END PGP SIGNATURE-----
-------------- next part --------------
9c9
< * $Id: check_smtp.c,v 1.9.2.2 2003/03/07 07:15:40 kdebisschop Exp $
---
> * $Id: aws_check_smtp.c,v 1.1.1.1 2004/02/26 20:29:26 nagios Exp $
18a19,22
> * Revision:
> *  Jason Martin <jhmartin at toger.us>
> *  Handle non-integer time thresholds
> *  
72c76
< int warning_time = 0;
---
> double warning_time = 0;
74c78
< int critical_time = 0;
---
> double critical_time = 0;
76a81,82
> struct timeval tv;
> double elapsed_time;
111c117,118
< 	time (&start_time);
---
>         /* time (&start_time); */
> 	gettimeofday (&tv, NULL);
129c136
< 					printf ("Invalid SMTP response received from host\n");
---
> 				{printf ("Invalid SMTP response received from host\n");}
131,132c138,139
< 					printf ("Invalid SMTP response received from host on port %d\n",
< 									server_port);
---
> 				{printf ("Invalid SMTP response received from host on port %d\n",
> 									server_port);}
163c170,171
< 	time (&end_time);
---
> 	/* time (&end_time); */
> 	elapsed_time = delta_time (tv);
165c173
< 	if (check_critical_time == TRUE && (end_time - start_time) > critical_time)
---
> 	if (check_critical_time == TRUE && elapsed_time > critical_time)
167c175
< 	else if (check_warning_time == TRUE && (end_time - start_time) > warning_time)
---
> 	else if (check_warning_time == TRUE && elapsed_time > warning_time)
171,172c179
< 		printf ("SMTP %s - %d sec. response time, %s\n",
< 						state_text (result), (int) (end_time - start_time), buffer);
---
> 		printf ("SMTP %s - %7.3f sec. response time, %s\n", state_text (result), elapsed_time, buffer);
174c181
< 		printf ("SMTP %s - %d second response time\n", state_text (result), (int) (end_time - start_time));
---
> 		printf ("SMTP %s - %7.3f second response time\n", state_text (result), elapsed_time);
253,254c260,261
< 			if (is_intnonneg (optarg)) {
< 				critical_time = atoi (optarg);
---
> 			if (is_numnonneg (optarg)) {
> 				critical_time = strtod(optarg,NULL);
262,263c269,270
< 			if (is_intnonneg (optarg)) {
< 				warning_time = atoi (optarg);
---
> 			if (is_numnonneg (optarg)) {
> 				warning_time = strtod(optarg,NULL);
282c289
< 			print_revision (progname, "$Revision: 1.9.2.2 $");
---
> 			print_revision (progname, "$Revision: 1.1.1.1 $");
328c335
< 	print_revision (progname, "$Revision: 1.9.2.2 $");
---
> 	print_revision (progname, "$Revision: 1.1.1.1 $");


More information about the Devel mailing list