[icinga-checkins] icinga.org: icinga2/fix/flapping-9969: Fix problem notifications while flapping is active

git at icinga.org git at icinga.org
Mon Feb 22 19:49:13 CET 2016


Module: icinga2
Branch: fix/flapping-9969
Commit: b2234315c61a0757117e340301d62da5e1c59c88
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b2234315c61a0757117e340301d62da5e1c59c88

Author: Sebastian Chrostek <sebastian at chrostek.net>
Date:   Mon Feb 22 19:43:44 2016 +0100

Fix problem notifications while flapping is active

refs #9969
refs #9642

---

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

diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index 65747a0..ebec155 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -346,22 +346,24 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
 	if (send_downtime_notification)
 		OnNotificationsRequested(this, in_downtime ? NotificationDowntimeStart : NotificationDowntimeEnd, cr, "", "");
 
-	if (!was_flapping && is_flapping) {
-		OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "");
+	if (send_notification) {
+		if (!was_flapping && is_flapping) {
+			OnNotificationsRequested(this, NotificationFlappingStart, cr, "", "");
 
-		Log(LogNotice, "Checkable")
-		    << "Flapping: Checkable " << GetName() << " started flapping (" << GetFlappingThreshold() << "% < " << GetFlappingCurrent() << "%).";
+			Log(LogNotice, "Checkable")
+				<< "Flapping: Checkable " << GetName() << " started flapping (" << GetFlappingThreshold() << "% < " << GetFlappingCurrent() << "%).";
 
-		NotifyFlapping(origin);
-	} else if (was_flapping && !is_flapping) {
-		OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "");
+			NotifyFlapping(origin);
+		} else if (was_flapping && !is_flapping) {
+			OnNotificationsRequested(this, NotificationFlappingEnd, cr, "", "");
 
-		Log(LogNotice, "Checkable")
-		    << "Flapping: Checkable " << GetName() << " stopped flapping (" << GetFlappingThreshold() << "% >= " << GetFlappingCurrent() << "%).";
+			Log(LogNotice, "Checkable")
+				<< "Flapping: Checkable " << GetName() << " stopped flapping (" << GetFlappingThreshold() << "% >= " << GetFlappingCurrent() << "%).";
 
-		NotifyFlapping(origin);
-	} else if (send_notification)
-		OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "");
+			NotifyFlapping(origin);
+		} else if (!was_flapping && !is_flapping)
+			OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "");
+	}
 }
 
 void Checkable::ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros)



More information about the icinga-checkins mailing list