]> granicus.if.org Git - icinga2/commitdiff
Fix problem notifications while flapping is active
authorSebastian Chrostek <sebastian@chrostek.net>
Mon, 22 Feb 2016 18:43:44 +0000 (19:43 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 11 Mar 2016 14:24:02 +0000 (15:24 +0100)
fixes #9969
fixes #9642

lib/icinga/checkable-check.cpp

index 65747a02f346ffd23e4db3455bc0f0d5b6f7da78..ebec1550199994e3047fa6b866fb2e8b9346aff8 100644 (file)
@@ -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)