]> granicus.if.org Git - icinga2/commitdiff
Flapping{Start,End} notifications must not depend on state changes
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 13 Jun 2016 08:12:38 +0000 (10:12 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 15 Jun 2016 15:43:37 +0000 (17:43 +0200)
fixes #11899

lib/icinga/checkable-check.cpp

index 0fe57af71d352ab3e06213375e7e9e9c7a3ee233..831b51a17970ddd28793dc6e90bb281210b03aad 100644 (file)
@@ -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());
        }
 }