[monitoring-plugins] check_ldap: fix entries threshold check

Sven Nierlein git at monitoring-plugins.org
Wed Apr 22 11:50:11 CEST 2015


 Module: monitoring-plugins
 Branch: test_1335
 Commit: 8beeb86e0236423a2c006192f1e6e47351bc63f0
 Author: Sven Nierlein <sven at nierlein.de>
   Date: Wed Apr 22 11:44:13 2015 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=8beeb86

check_ldap: fix entries threshold check

fix typo in threshold check. instead of setting the state always
to warning, use the result from the thresholds entry check.

Signed-off-by: Sven Nierlein <sven at nierlein.de>

---

 plugins/check_ldap.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 1c09dfa..cfc8222 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -1,29 +1,29 @@
 /*****************************************************************************
-* 
+*
 * Monitoring check_ldap plugin
-* 
+*
 * License: GPL
 * Copyright (c) 2000-2008 Monitoring Plugins Development Team
-* 
+*
 * Description:
-* 
+*
 * This file contains the check_ldap plugin
-* 
-* 
+*
+*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
-* 
+*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
-* 
+*
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
-* 
-* 
+*
+*
 *****************************************************************************/
 
 /* progname may be check_ldaps */
@@ -234,11 +234,17 @@ main (int argc, char *argv[])
 	else
 		status = STATE_OK;
 
-	status_entries = get_status(num_entries, entries_thresholds);
-	if (status_entries == STATE_CRITICAL) {
-		status = STATE_CRITICAL;
-	} else if (status!=STATE_CRITICAL) {
-		status = STATE_WARNING;
+	if(entries_thresholds != NULL) {
+		if (verbose) {
+			printf ("entries found: %d\n", num_entries);
+			print_thresholds("entry threasholds", entries_thresholds);
+		}
+		status_entries = get_status(num_entries, entries_thresholds);
+		if (status_entries == STATE_CRITICAL) {
+			status = STATE_CRITICAL;
+		} else if (status != STATE_CRITICAL) {
+			status = status_entries;
+		}
 	}
 
 	/* print out the result */



More information about the Commits mailing list