From efafcecced036295f50230d75308f10e0070b2c0 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 22 Aug 2014 12:23:45 +0200 Subject: [PATCH] Implement load balancing for notifications fixes #6203 --- components/notification/notification-type.conf | 1 + components/notification/notificationcomponent.cpp | 6 ++++++ components/notification/notificationcomponent.ti | 3 +++ 3 files changed, 10 insertions(+) diff --git a/components/notification/notification-type.conf b/components/notification/notification-type.conf index bcb3f676b..54bf6d5d6 100644 --- a/components/notification/notification-type.conf +++ b/components/notification/notification-type.conf @@ -18,4 +18,5 @@ ******************************************************************************/ %type NotificationComponent { + %attribute %number "enable_ha" } diff --git a/components/notification/notificationcomponent.cpp b/components/notification/notificationcomponent.cpp index faf2a7092..efe0b66ea 100644 --- a/components/notification/notificationcomponent.cpp +++ b/components/notification/notificationcomponent.cpp @@ -75,6 +75,9 @@ void NotificationComponent::NotificationTimerHandler(void) BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects()) { Checkable::Ptr checkable = notification->GetCheckable(); + if (checkable->IsPaused() && GetEnableHA()) + continue; + if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !checkable->GetEnableNotifications()) continue; @@ -128,5 +131,8 @@ void NotificationComponent::NotificationTimerHandler(void) void NotificationComponent::SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type, const CheckResult::Ptr& cr, const String& author, const String& text) { + if (checkable->IsPaused() && GetEnableHA()) + return; + checkable->SendNotifications(type, cr, author, text); } diff --git a/components/notification/notificationcomponent.ti b/components/notification/notificationcomponent.ti index 1758f9537..53a28d7b3 100644 --- a/components/notification/notificationcomponent.ti +++ b/components/notification/notificationcomponent.ti @@ -5,6 +5,9 @@ namespace icinga class NotificationComponent : DynamicObject { + [config] bool enable_ha (EnableHA) { + default {{{ return true; }}} + }; }; } -- 2.40.0