livestatus: fix host/servicegroup tables

add empty data providers for all requestable columns.

refs #4372
This commit is contained in:
Michael Friedrich 2013-07-11 12:43:27 +02:00
parent f631304a23
commit 3184fee145
5 changed files with 300 additions and 2 deletions

View File

@ -35,7 +35,29 @@ void HostGroupsTable::AddColumns(Table *table, const String& prefix,
{
table->AddColumn(prefix + "name", Column(&HostGroupsTable::NameAccessor, objectAccessor));
table->AddColumn(prefix + "alias", Column(&HostGroupsTable::AliasAccessor, objectAccessor));
table->AddColumn(prefix + "notes", Column(&HostGroupsTable::NotesAccessor, objectAccessor));
table->AddColumn(prefix + "notes_url", Column(&HostGroupsTable::NotesUrlAccessor, objectAccessor));
table->AddColumn(prefix + "action_url", Column(&HostGroupsTable::ActionUrlAccessor, objectAccessor));
table->AddColumn(prefix + "members", Column(&HostGroupsTable::MembersAccessor, objectAccessor));
table->AddColumn(prefix + "members_with_state", Column(&HostGroupsTable::MembersWithStateAccessor, objectAccessor));
table->AddColumn(prefix + "worst_host_state", Column(&HostGroupsTable::WorstHostStateAccessor, objectAccessor));
table->AddColumn(prefix + "num_hosts", Column(&HostGroupsTable::NumHostsAccessor, objectAccessor));
table->AddColumn(prefix + "num_hosts_pending", Column(&HostGroupsTable::NumHostsPendingAccessor, objectAccessor));
table->AddColumn(prefix + "num_hosts_up", Column(&HostGroupsTable::NumHostsUpAccessor, objectAccessor));
table->AddColumn(prefix + "num_hosts_down", Column(&HostGroupsTable::NumHostsDownAccessor, objectAccessor));
table->AddColumn(prefix + "num_hosts_unreach", Column(&HostGroupsTable::NumHostsUnreachAccessor, objectAccessor));
table->AddColumn(prefix + "num_services", Column(&HostGroupsTable::NumServicesAccessor, objectAccessor));
table->AddColumn(prefix + "worst_services_state", Column(&HostGroupsTable::WorstServicesStateAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_pending", Column(&HostGroupsTable::NumServicesPendingAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_ok", Column(&HostGroupsTable::NumServicesOkAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_warn", Column(&HostGroupsTable::NumServicesWarnAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_crit", Column(&HostGroupsTable::NumServicesCritAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_unknown", Column(&HostGroupsTable::NumServicesUnknownAccessor, objectAccessor));
table->AddColumn(prefix + "worst_service_hard_state", Column(&HostGroupsTable::WorstServiceHardStateAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_ok", Column(&HostGroupsTable::NumServicesHardOkAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_warn", Column(&HostGroupsTable::NumServicesHardWarnAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_crit", Column(&HostGroupsTable::NumServicesHardCritAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_unknown", Column(&HostGroupsTable::NumServicesHardUnknownAccessor, objectAccessor));
}
String HostGroupsTable::GetName(void) const
@ -60,6 +82,24 @@ Value HostGroupsTable::AliasAccessor(const Value& row)
return static_cast<HostGroup::Ptr>(row)->GetName();
}
Value HostGroupsTable::NotesAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NotesUrlAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::ActionUrlAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::MembersAccessor(const Value& row)
{
Array::Ptr members = boost::make_shared<Array>();
@ -70,3 +110,117 @@ Value HostGroupsTable::MembersAccessor(const Value& row)
return members;
}
Value HostGroupsTable::MembersWithStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::WorstHostStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumHostsAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumHostsPendingAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumHostsUpAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumHostsDownAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumHostsUnreachAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::WorstServicesStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesPendingAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesOkAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesWarnAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesCritAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesUnknownAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::WorstServiceHardStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesHardOkAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesHardWarnAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesHardCritAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value HostGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
{
/* TODO */
return Value();
}

View File

@ -47,7 +47,29 @@ protected:
static Value NameAccessor(const Value& row);
static Value AliasAccessor(const Value& row);
static Value NotesAccessor(const Value& row);
static Value NotesUrlAccessor(const Value& row);
static Value ActionUrlAccessor(const Value& row);
static Value MembersAccessor(const Value& row);
static Value MembersWithStateAccessor(const Value& row);
static Value WorstHostStateAccessor(const Value& row);
static Value NumHostsAccessor(const Value& row);
static Value NumHostsPendingAccessor(const Value& row);
static Value NumHostsUpAccessor(const Value& row);
static Value NumHostsDownAccessor(const Value& row);
static Value NumHostsUnreachAccessor(const Value& row);
static Value NumServicesAccessor(const Value& row);
static Value WorstServicesStateAccessor(const Value& row);
static Value NumServicesPendingAccessor(const Value& row);
static Value NumServicesOkAccessor(const Value& row);
static Value NumServicesWarnAccessor(const Value& row);
static Value NumServicesCritAccessor(const Value& row);
static Value NumServicesUnknownAccessor(const Value& row);
static Value WorstServiceHardStateAccessor(const Value& row);
static Value NumServicesHardOkAccessor(const Value& row);
static Value NumServicesHardWarnAccessor(const Value& row);
static Value NumServicesHardCritAccessor(const Value& row);
static Value NumServicesHardUnknownAccessor(const Value& row);
};
}

View File

@ -35,7 +35,22 @@ void ServiceGroupsTable::AddColumns(Table *table, const String& prefix,
{
table->AddColumn(prefix + "name", Column(&ServiceGroupsTable::NameAccessor, objectAccessor));
table->AddColumn(prefix + "alias", Column(&ServiceGroupsTable::AliasAccessor, objectAccessor));
table->AddColumn(prefix + "notes", Column(&ServiceGroupsTable::NotesAccessor, objectAccessor));
table->AddColumn(prefix + "notes_url", Column(&ServiceGroupsTable::NotesUrlAccessor, objectAccessor));
table->AddColumn(prefix + "action_url", Column(&ServiceGroupsTable::ActionUrlAccessor, objectAccessor));
table->AddColumn(prefix + "members", Column(&ServiceGroupsTable::MembersAccessor, objectAccessor));
table->AddColumn(prefix + "members_with_state", Column(&ServiceGroupsTable::MembersWithStateAccessor, objectAccessor));
table->AddColumn(prefix + "worst_service_state", Column(&ServiceGroupsTable::WorstServiceStateAccessor, objectAccessor));
table->AddColumn(prefix + "num_services", Column(&ServiceGroupsTable::NumServicesAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_ok", Column(&ServiceGroupsTable::NumServicesOkAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_warn", Column(&ServiceGroupsTable::NumServicesWarnAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_crit", Column(&ServiceGroupsTable::NumServicesCritAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_unknown", Column(&ServiceGroupsTable::NumServicesUnknownAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_pending", Column(&ServiceGroupsTable::NumServicesPendingAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_ok", Column(&ServiceGroupsTable::NumServicesHardOkAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_warn", Column(&ServiceGroupsTable::NumServicesHardWarnAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_crit", Column(&ServiceGroupsTable::NumServicesHardCritAccessor, objectAccessor));
table->AddColumn(prefix + "num_services_hard_unknown", Column(&ServiceGroupsTable::NumServicesHardUnknownAccessor, objectAccessor));
}
String ServiceGroupsTable::GetName(void) const
@ -60,6 +75,24 @@ Value ServiceGroupsTable::AliasAccessor(const Value& row)
return static_cast<ServiceGroup::Ptr>(row)->GetName();
}
Value ServiceGroupsTable::NotesAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NotesUrlAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::ActionUrlAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::MembersAccessor(const Value& row)
{
Array::Ptr members = boost::make_shared<Array>();
@ -70,3 +103,75 @@ Value ServiceGroupsTable::MembersAccessor(const Value& row)
return members;
}
Value ServiceGroupsTable::MembersWithStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::WorstServiceStateAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesOkAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesWarnAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesCritAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesUnknownAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesPendingAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesHardOkAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesHardWarnAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesHardCritAccessor(const Value& row)
{
/* TODO */
return Value();
}
Value ServiceGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
{
/* TODO */
return Value();
}

View File

@ -47,7 +47,22 @@ protected:
static Value NameAccessor(const Value& row);
static Value AliasAccessor(const Value& row);
static Value NotesAccessor(const Value& row);
static Value NotesUrlAccessor(const Value& row);
static Value ActionUrlAccessor(const Value& row);
static Value MembersAccessor(const Value& row);
static Value MembersWithStateAccessor(const Value& row);
static Value WorstServiceStateAccessor(const Value& row);
static Value NumServicesAccessor(const Value& row);
static Value NumServicesOkAccessor(const Value& row);
static Value NumServicesWarnAccessor(const Value& row);
static Value NumServicesCritAccessor(const Value& row);
static Value NumServicesUnknownAccessor(const Value& row);
static Value NumServicesPendingAccessor(const Value& row);
static Value NumServicesHardOkAccessor(const Value& row);
static Value NumServicesHardWarnAccessor(const Value& row);
static Value NumServicesHardCritAccessor(const Value& row);
static Value NumServicesHardUnknownAccessor(const Value& row);
};
}

View File

@ -21,7 +21,9 @@
#include "livestatus/statustable.h"
#include "livestatus/contactgroupstable.h"
#include "livestatus/contactstable.h"
#include "livestatus/hostgroupstable.h"
#include "livestatus/hoststable.h"
#include "livestatus/servicegroupstable.h"
#include "livestatus/servicestable.h"
#include "livestatus/commandstable.h"
#include "livestatus/commentstable.h"
@ -50,11 +52,11 @@ Table::Ptr Table::GetByName(const String& name)
else if (name == "contacts")
return boost::make_shared<ContactsTable>();
else if (name == "hostgroups")
return boost::make_shared<HostsTable>();
return boost::make_shared<HostGroupsTable>();
else if (name == "hosts")
return boost::make_shared<HostsTable>();
else if (name == "servicegroups")
return boost::make_shared<ServicesTable>();
return boost::make_shared<ServiceGroupsTable>();
else if (name == "services")
return boost::make_shared<ServicesTable>();
else if (name == "commands")