From: Sebastian Chrostek Date: Mon, 22 Feb 2016 18:43:44 +0000 (+0100) Subject: Fix problem notifications while flapping is active X-Git-Tag: v2.4.4~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5f0f7bd6e1e763628a6211523e3a25c8dc1a6e8;p=icinga2 Fix problem notifications while flapping is active fixes #9969 fixes #9642 --- diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 65747a02f..ebec15501 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)