From cd4ebf1bf27806d494561c12a93bc62638ddd726 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 1 Aug 2013 10:44:15 +0200 Subject: [PATCH] ido: add notify_on_* to host/service config refs #4378 --- lib/icinga/compatutility.cpp | 8 +++++--- lib/ido/hostdbobject.cpp | 10 +++++----- lib/ido/servicedbobject.cpp | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 902ee5dc5..62c932c35 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -196,8 +196,11 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se if (notification->GetNotificationStateFilter()) notification_state_filter = notification->GetNotificationStateFilter(); + + Log(LogDebug, "compatutility", "notification_type_filter: " + Convert::ToString(notification_type_filter) + " notification_state_filter: " + Convert::ToString(notification_state_filter)); } + if (notification_interval == -1) notification_interval = 60; @@ -228,7 +231,7 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se else attr->Set("alias", host->GetDisplayName()); - /* notification filters */ + /* notification state filters */ if (notification_state_filter & (1<Set("notify_on_down", 1); @@ -244,7 +247,7 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se custom = service->GetCustom(); macros = service->GetMacros(); - /* notification filters */ + /* notification state filters */ if (notification_state_filter & (1<Set("notify_on_warning", 1); notification_options.push_back("w"); @@ -306,7 +309,6 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se } /* custom attr */ - /* TODO resolve all static macros */ if (custom) { attr->Set("notes", custom->Get("notes")); attr->Set("notes_url", custom->Get("notes_url")); diff --git a/lib/ido/hostdbobject.cpp b/lib/ido/hostdbobject.cpp index 7b09b3033..ced211f57 100644 --- a/lib/ido/hostdbobject.cpp +++ b/lib/ido/hostdbobject.cpp @@ -74,11 +74,11 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const fields->Set("first_notification_delay", Empty); fields->Set("notification_interval", attrs->Get("notification_interval")); - fields->Set("notify_on_down", Empty); - fields->Set("notify_on_unreachable", Empty); - fields->Set("notify_on_recovery", Empty); - fields->Set("notify_on_flapping", Empty); - fields->Set("notify_on_downtime", Empty); + fields->Set("notify_on_down", attrs->Get("notify_on_down")); + fields->Set("notify_on_unreachable", attrs->Get("notify_on_unreachable")); + fields->Set("notify_on_recovery", attrs->Get("notify_on_recovery")); + fields->Set("notify_on_flapping", attrs->Get("notify_on_flapping")); + fields->Set("notify_on_downtime", attrs->Get("notify_on_downtime")); fields->Set("stalk_on_up", Empty); fields->Set("stalk_on_down", Empty); diff --git a/lib/ido/servicedbobject.cpp b/lib/ido/servicedbobject.cpp index da49dc548..595b8dc09 100644 --- a/lib/ido/servicedbobject.cpp +++ b/lib/ido/servicedbobject.cpp @@ -66,12 +66,12 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields(void) const fields->Set("max_check_attempts", attrs->Get("max_check_attempts")); fields->Set("first_notification_delay", Empty); fields->Set("notification_interval", attrs->Get("notification_interval")); - fields->Set("notify_on_warning", Empty); - fields->Set("notify_on_unknown", Empty); - fields->Set("notify_on_critical", Empty); - fields->Set("notify_on_recovery", Empty); - fields->Set("notify_on_flapping", Empty); - fields->Set("notify_on_downtime", Empty); + fields->Set("notify_on_warning", attrs->Get("notify_on_warning")); + fields->Set("notify_on_unknown", attrs->Get("notify_on_unknown")); + fields->Set("notify_on_critical", attrs->Get("notify_on_critical")); + fields->Set("notify_on_recovery", attrs->Get("notify_on_recovery")); + fields->Set("notify_on_flapping", attrs->Get("notify_on_flapping")); + fields->Set("notify_on_downtime", attrs->Get("notify_on_downtime")); fields->Set("stalk_on_ok", 0); fields->Set("stalk_on_warning", 0); fields->Set("stalk_on_unknown", 0);