Use legacy attribute getters in interfaces.

Fixes #6041
This commit is contained in:
Michael Friedrich 2014-04-17 13:49:45 +02:00
parent 50e8c5f8da
commit c7659337b7
11 changed files with 83 additions and 143 deletions

View 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"

View 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)

View 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;
}
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");
String perfdata;
CheckResult::Ptr cr = host->GetLastCheckResult();
if (cr)
perfdata = CompatUtility::GetCheckResultPerfdata(cr);
return perfdata;
}
Value HostsTable::IconImageAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
if (!host)
return Empty;
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)

View 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);
}

View 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

View 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);

View 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;
}

View 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());

View File

@ -1,4 +1,4 @@
GET hosts
Columns: name parents childs check_service
Columns: name parents childs
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET hosts
Columns: name notes notes_url action_url icon_image icon_image_alt
ResponseHeader: fixed16

View File

@ -0,0 +1,4 @@
GET services
Columns: host_name description notes notes_url action_url icon_image icon_image_alt
ResponseHeader: fixed16