From 6bf086dc9189554864056dd338a6a8f20790fdee Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 27 Feb 2013 18:15:01 +0100 Subject: [PATCH] Implemented notification_interval attribute for hosts. --- components/notification/notificationcomponent.cpp | 3 +++ itl/types.conf | 1 + lib/icinga/host.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/components/notification/notificationcomponent.cpp b/components/notification/notificationcomponent.cpp index 60793cfd3..0d5b44dd8 100644 --- a/components/notification/notificationcomponent.cpp +++ b/components/notification/notificationcomponent.cpp @@ -67,6 +67,9 @@ void NotificationComponent::NotificationTimerHandler(void) if (service->GetState() == StateOK) continue; + if (service->GetNotificationInterval() <= 0) + continue; + if (service->GetLastNotification() > now - service->GetNotificationInterval()) continue; diff --git a/itl/types.conf b/itl/types.conf index d7e763991..af7b94197 100644 --- a/itl/types.conf +++ b/itl/types.conf @@ -125,6 +125,7 @@ type Host { %attribute number "max_check_attempts", %attribute number "check_interval", %attribute number "retry_interval", + %attribute number "notification_interval", %attribute dictionary "macros" { %attribute string "*" }, diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 62b9c1673..6cb24c555 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -173,6 +173,10 @@ static void CopyServiceAttributes(TDict serviceDesc, const ConfigItemBuilder::Pt if (!short_name.IsEmpty()) builder->AddExpression("short_name", OperatorSet, short_name); + Value notification_interval = serviceDesc->Get("notification_interval"); + if (!notification_interval.IsEmpty()) + builder->AddExpression("notification_interval", OperatorSet, notification_interval); + if (copyServiceAttrs) { Value servicedependencies = serviceDesc->Get("servicedependencies"); if (!servicedependencies.IsEmpty()) -- 2.40.0