Implement load balancing for notifications

fixes #6203
This commit is contained in:
Michael Friedrich 2014-08-22 12:23:45 +02:00
parent e31d520f6b
commit efafcecced
3 changed files with 10 additions and 0 deletions

View File

@ -18,4 +18,5 @@
******************************************************************************/ ******************************************************************************/
%type NotificationComponent { %type NotificationComponent {
%attribute %number "enable_ha"
} }

View File

@ -75,6 +75,9 @@ void NotificationComponent::NotificationTimerHandler(void)
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) { BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
Checkable::Ptr checkable = notification->GetCheckable(); Checkable::Ptr checkable = notification->GetCheckable();
if (checkable->IsPaused() && GetEnableHA())
continue;
if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !checkable->GetEnableNotifications()) if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !checkable->GetEnableNotifications())
continue; continue;
@ -128,5 +131,8 @@ void NotificationComponent::NotificationTimerHandler(void)
void NotificationComponent::SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type, void NotificationComponent::SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type,
const CheckResult::Ptr& cr, const String& author, const String& text) const CheckResult::Ptr& cr, const String& author, const String& text)
{ {
if (checkable->IsPaused() && GetEnableHA())
return;
checkable->SendNotifications(type, cr, author, text); checkable->SendNotifications(type, cr, author, text);
} }

View File

@ -5,6 +5,9 @@ namespace icinga
class NotificationComponent : DynamicObject class NotificationComponent : DynamicObject
{ {
[config] bool enable_ha (EnableHA) {
default {{{ return true; }}}
};
}; };
} }