[icinga-checkins] icinga.org: icinga2/master: Fix incorrect notifications for soft recoveries

git at icinga.org git at icinga.org
Wed Aug 24 15:20:22 CEST 2016


Module: icinga2
Branch: master
Commit: 8c1fc813d168e733bd55a2c3f49ac317ee6eeb0f
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=8c1fc813d168e733bd55a2c3f49ac317ee6eeb0f

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Aug 24 11:13:19 2016 +0200

Fix incorrect notifications for soft recoveries

fixes #12529

---

 lib/icinga/checkable-check.cpp |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index a064a80..00e4823 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -183,7 +183,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
 	if (IsStateOK(cr->GetState())) {
 		SetStateType(StateTypeHard); // NOT-OK -> HARD OK
 
-		if (old_stateType == StateTypeHard && !IsStateOK(old_state))
+		if (!IsStateOK(old_state))
 			recovery = true;
 
 		ResetNotificationNumbers();
@@ -278,7 +278,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
 
 	if (notification_reachable && !in_downtime && !IsAcknowledged()) {
 		/* Send notifications whether when a hard state change occured. */
-		if (hardChange)
+		if (hardChange && !(old_stateType == StateTypeSoft && IsStateOK(new_state)))
 			send_notification = true;
 		/* Or if the checkable is volatile and in a HARD state. */
 		else if (is_volatile && GetStateType() == StateTypeHard)
@@ -383,17 +383,9 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
 		NotifyFlapping(origin);
 	}
 
-	if (recovery) {
-		/* Recovery notifications must be sent any time.
-		 * Users who where notified about a problem before
-		 * will be filtered when processing the notification.
-		 */
+	if (send_notification && !is_flapping) {
 		if (!IsPaused())
-			OnNotificationsRequested(this, NotificationRecovery, cr, "", "", MessageOrigin::Ptr());
-	} else if (send_notification && !is_flapping) {
-		/* Problem notifications */
-		if (!IsPaused())
-			OnNotificationsRequested(this, NotificationProblem, cr, "", "", MessageOrigin::Ptr());
+			OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
 	}
 }
 



More information about the icinga-checkins mailing list