]> granicus.if.org Git - icinga2/commitdiff
Implement load balancing for notifications
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 22 Aug 2014 10:23:45 +0000 (12:23 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 22 Aug 2014 11:00:52 +0000 (13:00 +0200)
fixes #6203

components/notification/notification-type.conf
components/notification/notificationcomponent.cpp
components/notification/notificationcomponent.ti

index bcb3f676b6a17bbf315e64bba4b4c2d8101c8ca4..54bf6d5d656277da6acbcf7ed70339a6f33de629 100644 (file)
@@ -18,4 +18,5 @@
  ******************************************************************************/
 
 %type NotificationComponent {
+       %attribute %number "enable_ha"
 }
index faf2a7092ad6f20d4fb88aae44c273f4afa1575d..efe0b66ea41f9ec81f7f1e5f8f4928f784c626f2 100644 (file)
@@ -75,6 +75,9 @@ void NotificationComponent::NotificationTimerHandler(void)
        BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
                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);
 }
index 1758f9537cec2104a6a8da8f22fd484c763f286c..53a28d7b3c6908d8f47199882ea544c6840580ca 100644 (file)
@@ -5,6 +5,9 @@ namespace icinga
 
 class NotificationComponent : DynamicObject
 {
+       [config] bool enable_ha (EnableHA) {
+               default {{{ return true; }}}
+       };
 };
 
 }