From: Michael Friedrich Date: Mon, 13 Jun 2016 08:12:38 +0000 (+0200) Subject: Flapping{Start,End} notifications must not depend on state changes X-Git-Tag: v2.5.0~261 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdd858a0ec150621d11f4af6fceffcbafb4b4844;p=icinga2 Flapping{Start,End} notifications must not depend on state changes fixes #11899 --- diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 0fe57af71..831b51a17 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()); } }