]> granicus.if.org Git - icinga2/commitdiff
ido: add notify_on_* to host/service config
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 1 Aug 2013 08:44:15 +0000 (10:44 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 1 Aug 2013 08:44:15 +0000 (10:44 +0200)
refs #4378

lib/icinga/compatutility.cpp
lib/ido/hostdbobject.cpp
lib/ido/servicedbobject.cpp

index 902ee5dc5abaf346bcea266e0d0c706554f97cf2..62c932c359d842fa1592cce8a321d1838a129594 100644 (file)
@@ -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<<StateWarning) ||
                                notification_state_filter & (1<<StateCritical)) {
                        attr->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<<StateWarning)) {
                        attr->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"));
index 7b09b3033c5ba0c01d093e291b574d0df4653027..ced211f5771011b64101edf339de7062dbdccd73 100644 (file)
@@ -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);
index da49dc548cf690ef447e49e2c7dd04a0fb6d7e30..595b8dc09cbf48d0bfd1485c6382b12334d30616 100644 (file)
@@ -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);