[icinga-checkins] icinga.org: icinga2/master: Implemented notification_interval attribute for hosts.

git at icinga.org git at icinga.org
Wed Feb 27 18:15:15 CET 2013


Module: icinga2
Branch: master
Commit: 6bf086dc9189554864056dd338a6a8f20790fdee
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=6bf086dc9189554864056dd338a6a8f20790fdee

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Feb 27 18:15:01 2013 +0100

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(+), 0 deletions(-)

diff --git a/components/notification/notificationcomponent.cpp b/components/notification/notificationcomponent.cpp
index 60793cf..0d5b44d 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 d7e7639..af7b941 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 62b9c16..6cb24c5 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())





More information about the icinga-checkins mailing list