Просмотр исходного кода

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@nierlein.de>
Sven Nierlein 10 лет назад
Родитель
Сommit
74ef7a623f
1 измененных файлов с 18 добавлено и 12 удалено
  1. 18 12
      plugins/check_ldap.c

+ 18 - 12
plugins/check_ldap.c

@@ -6,24 +6,24 @@
 * Copyright (c) 2000-2014 Nagios 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 */
@@ -251,11 +251,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 */