From: Michael Friedrich Date: Fri, 20 Feb 2015 20:30:14 +0000 (+0100) Subject: Don't increment check attempt counter on OK->NOT-OK transition X-Git-Tag: v2.3.9~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f252bb5c5ac143577a3a19db64428d013480e7d;p=icinga2 Don't increment check attempt counter on OK->NOT-OK transition This fixes the problem that the first SOFT state is actually considered the second state. refs #7287 fixes #9897 Signed-off-by: Michael Friedrich --- diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index bc4cacd12..13f0b2808 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -319,9 +319,12 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig } else { if (old_attempt >= GetMaxCheckAttempts()) { SetStateType(StateTypeHard); - } else if (old_stateType == StateTypeSoft || old_state == ServiceOK) { + } else if (old_stateType == StateTypeSoft && old_state != ServiceOK) { SetStateType(StateTypeSoft); - attempt = old_attempt + 1; + attempt = old_attempt + 1; //NOT-OK -> NOT-OK counter + } else if (old_state == ServiceOK) { + SetStateType(StateTypeSoft); + attempt = 1; //OK -> NOT-OK transition, reset the counter } else { attempt = old_attempt; }