[icinga-checkins] icinga.org: icinga2/fix/api-sync-repl-11684: Flapping{Start, End} notifications must not depend on state changes

git at icinga.org git at icinga.org
Wed Jun 15 17:50:20 CEST 2016


Module: icinga2
Branch: fix/api-sync-repl-11684
Commit: cdd858a0ec150621d11f4af6fceffcbafb4b4844
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=cdd858a0ec150621d11f4af6fceffcbafb4b4844

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon Jun 13 10:12:38 2016 +0200

Flapping{Start,End} notifications must not depend on state changes

fixes #11899

---

 lib/icinga/checkable-check.cpp |   44 +++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index 0fe57af..831b51a 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -370,27 +370,29 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
 	if (send_downtime_notification && IsActive())
 		OnNotificationsRequested(this, in_downtime ? NotificationDowntimeStart : NotificationDowntimeEnd, cr, "", "", MessageOrigin::Ptr());
 
-	if (send_notification) {
-		if (!was_flapping && is_flapping) {
-			if (!IsPaused())
-				OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", MessageOrigin::Ptr());
-
-			Log(LogNotice, "Checkable")
-				<< "Flapping: Checkable " << GetName() << " started flapping (" << GetFlappingThreshold() << "% < " << GetFlappingCurrent() << "%).";
-
-			NotifyFlapping(origin);
-		} else if (was_flapping && !is_flapping) {
-			if (!IsPaused())
-				OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", MessageOrigin::Ptr());
-
-			Log(LogNotice, "Checkable")
-				<< "Flapping: Checkable " << GetName() << " stopped flapping (" << GetFlappingThreshold() << "% >= " << GetFlappingCurrent() << "%).";
-
-			NotifyFlapping(origin);
-		} else if (!was_flapping && !is_flapping) {
-			if (!IsPaused())
-				OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
-		}
+	/* Flapping start/end notifications */
+	if (!was_flapping && is_flapping) {
+		if (!IsPaused())
+			OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "", MessageOrigin::Ptr());
+
+		Log(LogNotice, "Checkable")
+			<< "Flapping: Checkable " << GetName() << " started flapping (" << GetFlappingThreshold() << "% < " << GetFlappingCurrent() << "%).";
+
+		NotifyFlapping(origin);
+	} else if (was_flapping && !is_flapping) {
+		if (!IsPaused())
+			OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "", MessageOrigin::Ptr());
+
+		Log(LogNotice, "Checkable")
+			<< "Flapping: Checkable " << GetName() << " stopped flapping (" << GetFlappingThreshold() << "% >= " << GetFlappingCurrent() << "%).";
+
+		NotifyFlapping(origin);
+	}
+
+	/* Problem notifications */
+	if (send_notification && !is_flapping) {
+		if (!IsPaused())
+			OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
 	}
 }
 



More information about the icinga-checkins mailing list