[icinga-checkins] icinga.org: icinga2/master: Fix incorrect behavior for max_check_attempts
git at icinga.org
git at icinga.org
Mon Aug 8 11:04:02 CEST 2016
Module: icinga2
Branch: master
Commit: 597dc0dea26dc037584b1da9d982947ec59b4ad5
URL: https://git.icinga.org/?p=icinga2.git;a=commit;h=597dc0dea26dc037584b1da9d982947ec59b4ad5
Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date: Mon Aug 8 11:02:08 2016 +0200
Fix incorrect behavior for max_check_attempts
fixes #11898
---
lib/icinga/checkable-check.cpp | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index a56554f..299e9f2 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -177,9 +177,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
std::set<Checkable::Ptr> children = GetChildren();
- if (!old_cr) {
- SetStateType(StateTypeSoft);
- } else if (IsStateOK(cr->GetState())) {
+ if (IsStateOK(cr->GetState())) {
SetStateType(StateTypeHard); // NOT-OK -> HARD OK
if (!IsStateOK(old_state))
@@ -192,7 +190,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (!children.empty())
OnReachabilityChanged(this, cr, children, origin);
} else {
- if (old_attempt >= GetMaxCheckAttempts()) {
+ if (old_attempt + 1 >= GetMaxCheckAttempts()) {
SetStateType(StateTypeHard);
} else if (old_stateType == StateTypeSoft && !IsStateOK(old_state)) {
SetStateType(StateTypeSoft);
@@ -284,9 +282,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
send_notification = true;
}
- if (!old_cr)
- send_notification = false; /* Don't send notifications for the initial state change */
-
if (IsStateOK(old_state) && old_stateType == StateTypeSoft)
send_notification = false; /* Don't send notifications for SOFT-OK -> HARD-OK. */
More information about the icinga-checkins
mailing list