]> granicus.if.org Git - icinga2/commitdiff
Use legacy attribute getters in interfaces.
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 17 Apr 2014 11:49:45 +0000 (13:49 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 17 Apr 2014 11:50:26 +0000 (13:50 +0200)
Fixes #6041

components/compat/statusdatawriter.cpp
components/livestatus/contactstable.cpp
components/livestatus/hoststable.cpp
components/livestatus/servicestable.cpp
doc/6.12-schemas.md
lib/db_ido/hostdbobject.cpp
lib/db_ido/servicedbobject.cpp
lib/db_ido/userdbobject.cpp
test/livestatus/queries/host/host
test/livestatus/queries/host/legacy [new file with mode: 0644]
test/livestatus/queries/service/legacy [new file with mode: 0644]

index 4da15c127395fa9e3a9dccfb5768548f1fead9fe..c0101a4bd4dd2d739287b3471d112386206b74bb 100644 (file)
@@ -230,11 +230,11 @@ void StatusDataWriter::DumpHostStatus(std::ostream& fp, const Host::Ptr& host)
 
 void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
 {
-       String notes = CompatUtility::GetCustomAttributeConfig(host, "notes");
-       String notes_url = CompatUtility::GetCustomAttributeConfig(host, "notes_url");
-       String action_url = CompatUtility::GetCustomAttributeConfig(host, "action_url");
-       String icon_image = CompatUtility::GetCustomAttributeConfig(host, "icon_image");
-       String icon_image_alt = CompatUtility::GetCustomAttributeConfig(host, "icon_image_alt");
+       String notes = host->GetNotes();
+       String notes_url = host->GetNotesUrl();
+       String action_url = host->GetActionUrl();
+       String icon_image = host->GetIconImage();
+       String icon_image_alt = host->GetIconImageAlt();
        String statusmap_image = CompatUtility::GetCustomAttributeConfig(host, "statusmap_image");
        String display_name = host->GetDisplayName();
        String address = host->GetAddress();
@@ -460,11 +460,11 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
                 DumpNameList(fp, CompatUtility::GetCheckableNotificationUserGroups(service));
                 fp << "\n";
 
-               String notes = CompatUtility::GetCustomAttributeConfig(service, "notes");
-               String notes_url = CompatUtility::GetCustomAttributeConfig(service, "notes_url");
-               String action_url = CompatUtility::GetCustomAttributeConfig(service, "action_url");
-               String icon_image = CompatUtility::GetCustomAttributeConfig(service, "icon_image");
-               String icon_image_alt = CompatUtility::GetCustomAttributeConfig(service, "icon_image_alt");
+               String notes = service->GetNotes();
+               String notes_url = service->GetNotesUrl();
+               String action_url = service->GetActionUrl();
+               String icon_image = service->GetIconImage();
+               String icon_image_alt = service->GetIconImageAlt();
 
                 fp << "\t" "initial_state" "\t" "o" "\n"
                       "\t" "low_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
@@ -611,10 +611,21 @@ void StatusDataWriter::UpdateObjectsCache(void)
                std::ostringstream tempobjectfp;
                tempobjectfp << std::fixed;
 
+               String email = user->GetEmail();
+               String pager = user->GetPager();
+               String alias = user->GetDisplayName();
+
                tempobjectfp << "define contact {" "\n"
-                               "\t" "contact_name" "\t" << user->GetName() << "\n"
-                               "\t" "alias" "\t" << user->GetDisplayName() << "\n"
-                               "\t" "service_notification_options" "\t" "w,u,c,r,f,s" "\n"
+                               "\t" "contact_name" "\t" << user->GetName() << "\n";
+
+               if (!alias.IsEmpty())
+                       tempobjectfp << "\t" "alias" "\t" << alias << "\n";
+               if (!email.IsEmpty())
+                       tempobjectfp << "\t" "email" "\t" << email << "\n";
+               if (!pager.IsEmpty())
+                       tempobjectfp << "\t" "pager" "\t" << pager << "\n";
+
+               tempobjectfp << "\t" "service_notification_options" "\t" "w,u,c,r,f,s" "\n"
                                "\t" "host_notification_options""\t" "d,u,r,f,s" "\n"
                                "\t" "host_notifications_enabled" "\t" "1" "\n"
                                "\t" "service_notifications_enabled" "\t" "1" "\n"
index 12d9397e8a797d0f2239ac3ed15ab1010711944e..78f6be3f350da66197e8ea89c21b9e1f87378eca 100644 (file)
@@ -93,12 +93,7 @@ Value ContactsTable::EmailAccessor(const Value& row)
        if (!user)
                return Empty;
 
-       Dictionary::Ptr vars = user->GetVars();
-
-       if (!vars)
-               return Empty;
-
-       return vars->Get("email");
+       return user->GetEmail();
 }
 
 Value ContactsTable::PagerAccessor(const Value& row)
@@ -108,12 +103,7 @@ Value ContactsTable::PagerAccessor(const Value& row)
        if (!user)
                return Empty;
 
-       Dictionary::Ptr vars = user->GetVars();
-
-       if (!vars)
-               return Empty;
-
-       return vars->Get("pager");
+       return user->GetPager();
 }
 
 Value ContactsTable::HostNotificationPeriodAccessor(const Value& row)
index dcf25137a6b6d387ed5a45238b57d03d564daeb1..e365f694816c3fab667d4e414faba7cad38184bd 100644 (file)
@@ -228,7 +228,6 @@ Value HostsTable::CheckCommandAccessor(const Value& row)
 
 Value HostsTable::CheckCommandExpandedAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -243,7 +242,6 @@ Value HostsTable::CheckCommandExpandedAccessor(const Value& row)
 
 Value HostsTable::EventHandlerAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -258,7 +256,6 @@ Value HostsTable::EventHandlerAccessor(const Value& row)
 
 Value HostsTable::NotificationPeriodAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -269,7 +266,6 @@ Value HostsTable::NotificationPeriodAccessor(const Value& row)
 
 Value HostsTable::CheckPeriodAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -285,7 +281,7 @@ Value HostsTable::NotesAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(host, "notes");
+       return host->GetNotes();
 }
 
 Value HostsTable::NotesExpandedAccessor(const Value& row)
@@ -299,9 +295,7 @@ Value HostsTable::NotesExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", host));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(host, "notes");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(host->GetNotes(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value HostsTable::NotesUrlAccessor(const Value& row)
@@ -311,7 +305,7 @@ Value HostsTable::NotesUrlAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(host, "notes_url");
+       return host->GetNotesUrl();
 }
 
 Value HostsTable::NotesUrlExpandedAccessor(const Value& row)
@@ -325,9 +319,7 @@ Value HostsTable::NotesUrlExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", host));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(host, "notes_url");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(host->GetNotesUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value HostsTable::ActionUrlAccessor(const Value& row)
@@ -337,7 +329,7 @@ Value HostsTable::ActionUrlAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(host, "action_url");
+       return host->GetActionUrl();
 }
 
 Value HostsTable::ActionUrlExpandedAccessor(const Value& row)
@@ -351,14 +343,11 @@ Value HostsTable::ActionUrlExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", host));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(host, "action_url");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(host->GetActionUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value HostsTable::PluginOutputAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -373,20 +362,30 @@ Value HostsTable::PluginOutputAccessor(const Value& row)
        return output;
 }
 
-Value HostsTable::PerfDataAccessor(const Value&)
+Value HostsTable::PerfDataAccessor(const Value& row)
 {
-       return Empty;
+       Host::Ptr host = static_cast<Host::Ptr>(row);
+
+       if (!host)
+               return Empty;
+
+       String perfdata;
+       CheckResult::Ptr cr = host->GetLastCheckResult();
+
+       if (cr)
+               perfdata = CompatUtility::GetCheckResultPerfdata(cr);
+
+       return perfdata;
 }
 
 Value HostsTable::IconImageAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(host, "icon_image");
+       return host->GetIconImage();
 }
 
 Value HostsTable::IconImageExpandedAccessor(const Value& row)
@@ -400,9 +399,7 @@ Value HostsTable::IconImageExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", host));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(host, "icon_image");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(host->GetIconImage(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value HostsTable::IconImageAltAccessor(const Value& row)
@@ -412,7 +409,7 @@ Value HostsTable::IconImageAltAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(host, "icon_image_alt");
+       return host->GetIconImageAlt();
 }
 
 Value HostsTable::StatusmapImageAccessor(const Value& row)
@@ -427,7 +424,6 @@ Value HostsTable::StatusmapImageAccessor(const Value& row)
 
 Value HostsTable::LongPluginOutputAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -444,7 +440,6 @@ Value HostsTable::LongPluginOutputAccessor(const Value& row)
 
 Value HostsTable::MaxCheckAttemptsAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -455,7 +450,6 @@ Value HostsTable::MaxCheckAttemptsAccessor(const Value& row)
 
 Value HostsTable::FlapDetectionEnabledAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -466,7 +460,6 @@ Value HostsTable::FlapDetectionEnabledAccessor(const Value& row)
 
 Value HostsTable::AcceptPassiveChecksAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -477,7 +470,6 @@ Value HostsTable::AcceptPassiveChecksAccessor(const Value& row)
 
 Value HostsTable::EventHandlerEnabledAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -488,7 +480,6 @@ Value HostsTable::EventHandlerEnabledAccessor(const Value& row)
 
 Value HostsTable::AcknowledgementTypeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -499,7 +490,6 @@ Value HostsTable::AcknowledgementTypeAccessor(const Value& row)
 
 Value HostsTable::CheckTypeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -530,7 +520,6 @@ Value HostsTable::LastHardStateAccessor(const Value& row)
 
 Value HostsTable::CurrentAttemptAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -541,7 +530,6 @@ Value HostsTable::CurrentAttemptAccessor(const Value& row)
 
 Value HostsTable::LastNotificationAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -552,7 +540,6 @@ Value HostsTable::LastNotificationAccessor(const Value& row)
 
 Value HostsTable::NextNotificationAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -563,7 +550,6 @@ Value HostsTable::NextNotificationAccessor(const Value& row)
 
 Value HostsTable::NextCheckAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -574,7 +560,6 @@ Value HostsTable::NextCheckAccessor(const Value& row)
 
 Value HostsTable::LastHardStateChangeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -585,7 +570,6 @@ Value HostsTable::LastHardStateChangeAccessor(const Value& row)
 
 Value HostsTable::HasBeenCheckedAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -596,7 +580,6 @@ Value HostsTable::HasBeenCheckedAccessor(const Value& row)
 
 Value HostsTable::CurrentNotificationNumberAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -617,7 +600,6 @@ Value HostsTable::TotalServicesAccessor(const Value& row)
 
 Value HostsTable::ChecksEnabledAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -628,7 +610,6 @@ Value HostsTable::ChecksEnabledAccessor(const Value& row)
 
 Value HostsTable::NotificationsEnabledAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -639,7 +620,6 @@ Value HostsTable::NotificationsEnabledAccessor(const Value& row)
 
 Value HostsTable::AcknowledgedAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -650,7 +630,6 @@ Value HostsTable::AcknowledgedAccessor(const Value& row)
 
 Value HostsTable::StateAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -661,7 +640,6 @@ Value HostsTable::StateAccessor(const Value& row)
 
 Value HostsTable::StateTypeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -672,7 +650,6 @@ Value HostsTable::StateTypeAccessor(const Value& row)
 
 Value HostsTable::NoMoreNotificationsAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -683,7 +660,6 @@ Value HostsTable::NoMoreNotificationsAccessor(const Value& row)
 
 Value HostsTable::LastCheckAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -694,7 +670,6 @@ Value HostsTable::LastCheckAccessor(const Value& row)
 
 Value HostsTable::LastStateChangeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -705,7 +680,6 @@ Value HostsTable::LastStateChangeAccessor(const Value& row)
 
 Value HostsTable::LastTimeUpAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -716,7 +690,6 @@ Value HostsTable::LastTimeUpAccessor(const Value& row)
 
 Value HostsTable::LastTimeDownAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -727,7 +700,6 @@ Value HostsTable::LastTimeDownAccessor(const Value& row)
 
 Value HostsTable::LastTimeUnreachableAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -738,7 +710,6 @@ Value HostsTable::LastTimeUnreachableAccessor(const Value& row)
 
 Value HostsTable::IsFlappingAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -749,7 +720,6 @@ Value HostsTable::IsFlappingAccessor(const Value& row)
 
 Value HostsTable::ScheduledDowntimeDepthAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -760,8 +730,6 @@ Value HostsTable::ScheduledDowntimeDepthAccessor(const Value& row)
 
 Value HostsTable::ActiveChecksEnabledAccessor(const Value& row)
 {
-       /* duplicate of ChecksEnableAccessor */
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -778,7 +746,6 @@ Value HostsTable::CheckOptionsAccessor(const Value& row)
 
 Value HostsTable::ModifiedAttributesAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -795,7 +762,6 @@ Value HostsTable::ModifiedAttributesListAccessor(const Value& row)
 
 Value HostsTable::CheckIntervalAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -806,7 +772,6 @@ Value HostsTable::CheckIntervalAccessor(const Value& row)
 
 Value HostsTable::RetryIntervalAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -817,7 +782,6 @@ Value HostsTable::RetryIntervalAccessor(const Value& row)
 
 Value HostsTable::NotificationIntervalAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -828,7 +792,6 @@ Value HostsTable::NotificationIntervalAccessor(const Value& row)
 
 Value HostsTable::LowFlapThresholdAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -839,7 +802,6 @@ Value HostsTable::LowFlapThresholdAccessor(const Value& row)
 
 Value HostsTable::HighFlapThresholdAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -870,7 +832,6 @@ Value HostsTable::Y2dAccessor(const Value& row)
 
 Value HostsTable::LatencyAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -881,7 +842,6 @@ Value HostsTable::LatencyAccessor(const Value& row)
 
 Value HostsTable::ExecutionTimeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -892,7 +852,6 @@ Value HostsTable::ExecutionTimeAccessor(const Value& row)
 
 Value HostsTable::PercentStateChangeAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -903,7 +862,6 @@ Value HostsTable::PercentStateChangeAccessor(const Value& row)
 
 Value HostsTable::InNotificationPeriodAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -914,7 +872,6 @@ Value HostsTable::InNotificationPeriodAccessor(const Value& row)
 
 Value HostsTable::InCheckPeriodAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -925,7 +882,6 @@ Value HostsTable::InCheckPeriodAccessor(const Value& row)
 
 Value HostsTable::ContactsAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -942,7 +898,6 @@ Value HostsTable::ContactsAccessor(const Value& row)
 
 Value HostsTable::DowntimesAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -972,7 +927,6 @@ Value HostsTable::DowntimesAccessor(const Value& row)
 
 Value HostsTable::DowntimesWithInfoAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1006,7 +960,6 @@ Value HostsTable::DowntimesWithInfoAccessor(const Value& row)
 
 Value HostsTable::CommentsAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1036,7 +989,6 @@ Value HostsTable::CommentsAccessor(const Value& row)
 
 Value HostsTable::CommentsWithInfoAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1070,7 +1022,6 @@ Value HostsTable::CommentsWithInfoAccessor(const Value& row)
 
 Value HostsTable::CommentsWithExtraInfoAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1435,7 +1386,6 @@ Value HostsTable::NumServicesHardUnknownAccessor(const Value& row)
 
 Value HostsTable::HardStateAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1451,7 +1401,6 @@ Value HostsTable::HardStateAccessor(const Value& row)
 
 Value HostsTable::StalenessAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
@@ -1477,7 +1426,6 @@ Value HostsTable::GroupsAccessor(const Value& row)
 
 Value HostsTable::ContactGroupsAccessor(const Value& row)
 {
-       /* use hostcheck service */
        Host::Ptr host = static_cast<Host::Ptr>(row);
 
        if (!host)
index b521287d286904daf94ccf70b2763b8f8fda2887..a6af0e09ff596d9ea962ae09c48e05e2049e2c92 100644 (file)
@@ -300,7 +300,7 @@ Value ServicesTable::NotesAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(service, "notes");
+       return service->GetNotes();
 }
 
 Value ServicesTable::NotesExpandedAccessor(const Value& row)
@@ -315,9 +315,7 @@ Value ServicesTable::NotesExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", service->GetHost()));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(service, "notes");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(service->GetNotes(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value ServicesTable::NotesUrlAccessor(const Value& row)
@@ -327,7 +325,7 @@ Value ServicesTable::NotesUrlAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(service, "notes_url");
+       return service->GetNotesUrl();
 }
 
 Value ServicesTable::NotesUrlExpandedAccessor(const Value& row)
@@ -342,9 +340,7 @@ Value ServicesTable::NotesUrlExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", service->GetHost()));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(service, "notes_url");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(service->GetNotesUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value ServicesTable::ActionUrlAccessor(const Value& row)
@@ -354,7 +350,7 @@ Value ServicesTable::ActionUrlAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(service, "action_url");
+       return service->GetActionUrl();
 }
 
 Value ServicesTable::ActionUrlExpandedAccessor(const Value& row)
@@ -369,9 +365,7 @@ Value ServicesTable::ActionUrlExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", service->GetHost()));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(service, "action_url");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(service->GetActionUrl(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value ServicesTable::IconImageAccessor(const Value& row)
@@ -381,7 +375,7 @@ Value ServicesTable::IconImageAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(service, "icon_image");
+       return service->GetIconImage();
 }
 
 Value ServicesTable::IconImageExpandedAccessor(const Value& row)
@@ -396,9 +390,7 @@ Value ServicesTable::IconImageExpandedAccessor(const Value& row)
        resolvers.push_back(std::make_pair("host", service->GetHost()));
        resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
 
-       Value value = CompatUtility::GetCustomAttributeConfig(service, "icon_image");
-
-       return MacroProcessor::ResolveMacros(value, resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
+       return MacroProcessor::ResolveMacros(service->GetIconImage(), resolvers, CheckResult::Ptr(), Utility::EscapeShellCmd);
 }
 
 Value ServicesTable::IconImageAltAccessor(const Value& row)
@@ -408,7 +400,7 @@ Value ServicesTable::IconImageAltAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCustomAttributeConfig(service, "icon_image_alt");
+       return service->GetIconImageAlt();
 }
 
 Value ServicesTable::MaxCheckAttemptsAccessor(const Value& row)
@@ -498,7 +490,6 @@ Value ServicesTable::AcknowledgedAccessor(const Value& row)
        if (!service)
                return Empty;
 
-
        return CompatUtility::GetCheckableIsAcknowledged(service);
 }
 
@@ -702,7 +693,7 @@ Value ServicesTable::ProcessPerformanceDataAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return  CompatUtility::GetCheckableProcessPerformanceData(service);
+       return CompatUtility::GetCheckableProcessPerformanceData(service);
 }
 
 Value ServicesTable::ActiveChecksEnabledAccessor(const Value& row)
index ef501d630be234fc11f5eb95c30ba53d5c0f4a99..d2ca7b4ad8db23bff9cef3cb7780433a9a8c8818 100644 (file)
@@ -33,7 +33,6 @@ New columns:
   hoststatus          | check_source            | TEXT     | NULL    | node name where check was executed
   statehistory        | check_source            | TEXT     | NULL    | node name where check was executed
   logentries          | object_id               | bigint   | NULL    | FK: objects table (service associated with column)
-  hosts               | check_service_object_id | bigint   | NULL    | FK: objects table (service associated with column)
 
 Additional command custom variables populated from 'vars' dictionary.
 Additional global custom variables populated from 'Vars' constant (object_id is NULL).
@@ -177,7 +176,6 @@ New columns:
   Table     | Column
   ----------|--------------
   services  | check_source
-  hosts     | check_service
   downtimes | triggers
   downtimes | trigger_time
   commands  | custom_variable_names
index 3b09a17aa7404057d019b83e1b025c5a96e39d6d..8b597e504128cb911c908b81f814e552b3378284 100644 (file)
@@ -97,11 +97,11 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
        fields->Set("obsess_over_host", 0);
        fields->Set("failure_prediction_enabled", 0);
 
-       fields->Set("notes", CompatUtility::GetCustomAttributeConfig(host, "notes"));
-       fields->Set("notes_url", CompatUtility::GetCustomAttributeConfig(host, "notes_url"));
-       fields->Set("action_url", CompatUtility::GetCustomAttributeConfig(host, "action_url"));
-       fields->Set("icon_image", CompatUtility::GetCustomAttributeConfig(host, "icon_image"));
-       fields->Set("icon_image_alt", CompatUtility::GetCustomAttributeConfig(host, "icon_image_alt"));
+       fields->Set("notes", host->GetNotes());
+       fields->Set("notes_url", host->GetNotesUrl());
+       fields->Set("action_url", host->GetActionUrl());
+       fields->Set("icon_image", host->GetIconImage());
+       fields->Set("icon_image_alt", host->GetIconImageAlt());
        fields->Set("statusmap_image", CompatUtility::GetCustomAttributeConfig(host, "statusmap_image"));
 
        Host2dCoords coords = CompatUtility::GetHost2dCoords(host);
index c10722bb96b9a793391d98e94a2e12fd7ffcf6b4..5c9e5746686d601412fa3725fd67069255dfcb4e 100644 (file)
@@ -93,11 +93,11 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields(void) const
        fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(service));
        fields->Set("obsess_over_service", Empty);
        fields->Set("failure_prediction_enabled", Empty);
-       fields->Set("notes", CompatUtility::GetCustomAttributeConfig(service, "notes"));
-       fields->Set("notes_url", CompatUtility::GetCustomAttributeConfig(service, "notes_url"));
-       fields->Set("action_url", CompatUtility::GetCustomAttributeConfig(service, "action_url"));
-       fields->Set("icon_image", CompatUtility::GetCustomAttributeConfig(service, "icon_image"));
-       fields->Set("icon_image_alt", CompatUtility::GetCustomAttributeConfig(service, "icon_image_alt"));
+       fields->Set("notes", service->GetNotes());
+       fields->Set("notes_url", service->GetNotesUrl());
+       fields->Set("action_url", service->GetActionUrl());
+       fields->Set("icon_image", service->GetIconImage());
+       fields->Set("icon_image_alt", service->GetIconImageAlt());
 
        return fields;
 }
index 8d536065212dee0dad79990e5a6e8dad89bf52b1..3593a2e0817161ca127e80f0c769fee87b3c7ca6 100644 (file)
@@ -41,14 +41,8 @@ Dictionary::Ptr UserDbObject::GetConfigFields(void) const
        User::Ptr user = static_pointer_cast<User>(GetObject());
 
        fields->Set("alias", user->GetDisplayName());
-
-       Dictionary::Ptr vars = user->GetVars();
-
-       if (vars) { /* Yuck. */
-               fields->Set("email_address", vars->Get("email"));
-               fields->Set("pager_address", vars->Get("pager"));
-       }
-
+       fields->Set("email_address", user->GetEmail());
+       fields->Set("pager_address", user->GetPager());
        fields->Set("host_timeperiod_object_id", user->GetPeriod());
        fields->Set("service_timeperiod_object_id", user->GetPeriod());
        fields->Set("host_notifications_enabled", user->GetEnableNotifications());
index c869598c546bbad7296dd9f7d760beca2561aa58..4390fa91d3663c3e7d96dec65ea83aee58f20acc 100644 (file)
@@ -1,4 +1,4 @@
 GET hosts
-Columns: name parents childs check_service
+Columns: name parents childs
 ResponseHeader: fixed16
 
diff --git a/test/livestatus/queries/host/legacy b/test/livestatus/queries/host/legacy
new file mode 100644 (file)
index 0000000..7a94932
--- /dev/null
@@ -0,0 +1,4 @@
+GET hosts
+Columns: name notes notes_url action_url icon_image icon_image_alt
+ResponseHeader: fixed16
+
diff --git a/test/livestatus/queries/service/legacy b/test/livestatus/queries/service/legacy
new file mode 100644 (file)
index 0000000..ebc0b4b
--- /dev/null
@@ -0,0 +1,4 @@
+GET services
+Columns: host_name description notes notes_url action_url icon_image icon_image_alt
+ResponseHeader: fixed16
+