From 1297a3723f6c5a79e8148e56c249a1aa7d3c6f35 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 5 Mar 2008 14:15:02 +0100 Subject: [PATCH] src/utils_threshold.c: Fix the configuration of {Failure,Warning}Max and inverted checking. The first issue is a simple copy'n'paste error, the second a nasty oversight. --- src/utils_threshold.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils_threshold.c b/src/utils_threshold.c index ea4b5916..d0ab2b9f 100644 --- a/src/utils_threshold.c +++ b/src/utils_threshold.c @@ -146,9 +146,9 @@ static int ut_config_type_max (threshold_t *th, oconfig_item_t *ci) } if (strcasecmp (ci->key, "WarningMax") == 0) - th->warning_min = ci->values[0].value.number; + th->warning_max = ci->values[0].value.number; else - th->failure_min = ci->values[0].value.number; + th->failure_max = ci->values[0].value.number; return (0); } /* int ut_config_type_max */ @@ -536,13 +536,17 @@ int ut_check_threshold (const data_set_t *ds, const value_list_t *vl) int is_failure = 0; if ((th->flags & UT_FLAG_INVERT) != 0) + { is_inverted = 1; + is_warning--; + is_failure--; + } if ((!isnan (th->failure_min) && (th->failure_min > values[i])) || (!isnan (th->failure_max) && (th->failure_max < values[i]))) - is_failure = is_inverted - 1; + is_failure++; if ((!isnan (th->warning_min) && (th->warning_min > values[i])) || (!isnan (th->warning_max) && (th->warning_max < values[i]))) - is_warning = is_inverted - 1; + is_warning++; if ((is_failure != 0) || (is_warning != 0)) { -- 2.11.0