livestatus: finish host|servicegroup table attributes

refs #4372
This commit is contained in:
Michael Friedrich 2013-07-16 13:26:16 +02:00
parent df1d47a996
commit 2cc8ef17e1
2 changed files with 22 additions and 4 deletions

View File

@ -127,8 +127,16 @@ Value HostGroupsTable::MembersAccessor(const Value& row)
Value HostGroupsTable::MembersWithStateAccessor(const Value& row)
{
/* TODO */
return Empty;
Array::Ptr members = boost::make_shared<Array>();
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
Array::Ptr member_state = boost::make_shared<Array>();
member_state->Add(host->GetName());
member_state->Add(host->GetState());
members->Add(member_state);
}
return members;
}
Value HostGroupsTable::WorstHostStateAccessor(const Value& row)

View File

@ -121,8 +121,18 @@ Value ServiceGroupsTable::MembersAccessor(const Value& row)
Value ServiceGroupsTable::MembersWithStateAccessor(const Value& row)
{
/* TODO */
return Empty;
Array::Ptr members = boost::make_shared<Array>();
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
Array::Ptr host_svc = boost::make_shared<Array>();
host_svc->Add(service->GetHost()->GetName());
host_svc->Add(service->GetShortName());
host_svc->Add(service->GetHost()->GetState());
host_svc->Add(service->GetState());
members->Add(host_svc);
}
return members;
}
Value ServiceGroupsTable::WorstServiceStateAccessor(const Value& row)