[Nagiosplug-devel] check_ldap patch against 1.3.1

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


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

The attached patch addes non-integer timing thresholds to check_ldap. It 
also makes naming changes that are not necessary; the important thing is 
the threshold changes.

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

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

iD8DBQFAvLAml2ODWuqVSBMRAroEAJ4hjSHwSVqrUEunwLX+gzarZoXcpwCfZmNx
FLuFpCXRRlFFJpcqnczPbnk=
=rBhM
-----END PGP SIGNATURE-----
-------------- next part --------------
8c8
<  * Last Modified: $Date: 2003/01/29 06:16:15 $
---
>  * Last Modified: $Date: 2004/02/26 20:29:26 $
10c10
<  * Command line: check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time>
---
>  * Command line: aws_check_ldap -h <host> -b <base_dn> -p <port> -w <warn_time> -w <crit_time>
23,24c23,24
< const char *progname = "check_ldap";
< const char *revision = "$Revision: 1.4 $";
---
> const char *progname = "aws_check_ldap";
> const char *revision = "$Revision: 1.1.1.1 $";
51,52c51,53
< int warn_time = UNDEFINED;
< int crit_time = UNDEFINED;
---
> double warn_time = UNDEFINED;
> double crit_time = UNDEFINED;
> double elapsed_time;
61,62c62,64
< 	int t_diff;
< 	time_t time0, time1;
---
> 	/* int t_diff; */
> 	/* time_t time0, time1; */
> 	struct timeval tv;
65c67
< 		usage ("check_ldap: could not parse arguments\n");
---
> 		usage ("aws_check_ldap: could not parse arguments\n");
74c76
< 	time (&time0);
---
> 	gettimeofday(&tv,NULL);
86c88
< 		/*ldap_perror(ld, "ldap_bind"); */
---
> 		ldap_perror(ld, "ldap_bind"); 
106c108
< 	time (&time1);
---
> 	elapsed_time=delta_time(tv);
109c111
< 	t_diff = time1 - time0;
---
> 	/* t_diff = time1 - time0; */
111,112c113,114
< 	if (crit_time!=UNDEFINED && t_diff>=crit_time) {
< 		printf ("LDAP critical - %i seconds response time\n", t_diff);
---
> 	if (crit_time!=UNDEFINED && elapsed_time >= crit_time) {
> 		printf ("LDAP critical - %7.3f seconds response time\n", elapsed_time);
116,117c118,119
< 	if (warn_time!=UNDEFINED && t_diff>=warn_time) {
< 		printf ("LDAP warning - %i seconds response time\n", t_diff);
---
> 	if (warn_time!=UNDEFINED && elapsed_time >= warn_time) {
> 		printf ("LDAP warning - %7.3f seconds response time\n", elapsed_time);
122c124
< 	printf ("LDAP ok - %i seconds response time\n", t_diff);
---
> 	printf ("LDAP ok - %7.3f seconds response time\n", elapsed_time);
201c203,205
< 			warn_time = atoi (optarg);
---
> 			if (!is_numnonneg(optarg))
> 				usage2 ("timeout interval must be a positive integer", optarg);
> 			warn_time = strtod (optarg,NULL);
204c208,210
< 			crit_time = atoi (optarg);
---
> 			if (!is_numnonneg(optarg))
> 				usage2 ("timeout interval must be a positive integer", optarg);
> 			crit_time = strtod (optarg,NULL);
207c213
< 			usage ("check_ldap: could not parse arguments\n");
---
> 			usage ("aws_check_ldap: could not parse arguments\n");


More information about the Devel mailing list