mirror of https://github.com/Icinga/icinga2.git
parent
734b08d858
commit
a991fbe1b6
|
@ -150,6 +150,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
||||||
table->AddColumn(prefix + "num_services_hard_unknown", Column(&HostsTable::NumServicesHardUnknownAccessor, objectAccessor));
|
table->AddColumn(prefix + "num_services_hard_unknown", Column(&HostsTable::NumServicesHardUnknownAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "hard_state", Column(&HostsTable::HardStateAccessor, objectAccessor));
|
table->AddColumn(prefix + "hard_state", Column(&HostsTable::HardStateAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "pnpgraph_present", Column(&HostsTable::PnpgraphPresentAccessor, objectAccessor));
|
table->AddColumn(prefix + "pnpgraph_present", Column(&HostsTable::PnpgraphPresentAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "staleness", Column(&HostsTable::StalenessAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "groups", Column(&HostsTable::GroupsAccessor, objectAccessor));
|
table->AddColumn(prefix + "groups", Column(&HostsTable::GroupsAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "contact_groups", Column(&HostsTable::ContactGroupsAccessor, objectAccessor));
|
table->AddColumn(prefix + "contact_groups", Column(&HostsTable::ContactGroupsAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "services", Column(&HostsTable::ServicesAccessor, objectAccessor));
|
table->AddColumn(prefix + "services", Column(&HostsTable::ServicesAccessor, objectAccessor));
|
||||||
|
@ -1563,7 +1564,15 @@ Value HostsTable::PnpgraphPresentAccessor(const Value& row)
|
||||||
|
|
||||||
Value HostsTable::StalenessAccessor(const Value& row)
|
Value HostsTable::StalenessAccessor(const Value& row)
|
||||||
{
|
{
|
||||||
/* TODO time since last check normalized on the check_interval */
|
/* use hostcheck service */
|
||||||
|
Service::Ptr hc = static_cast<Host::Ptr>(row)->GetHostCheckService();
|
||||||
|
|
||||||
|
if (!hc)
|
||||||
|
return Empty;
|
||||||
|
|
||||||
|
if (hc->HasBeenChecked() && hc->GetLastCheck() > 0)
|
||||||
|
return (Utility::GetTime() - hc->GetLastCheck()) / (hc->GetCheckInterval() * 3600);
|
||||||
|
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
|
||||||
table->AddColumn(prefix + "modified_attributes", Column(&ServicesTable::ModifiedAttributesAccessor, objectAccessor));
|
table->AddColumn(prefix + "modified_attributes", Column(&ServicesTable::ModifiedAttributesAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "modified_attributes_list", Column(&ServicesTable::ModifiedAttributesListAccessor, objectAccessor));
|
table->AddColumn(prefix + "modified_attributes_list", Column(&ServicesTable::ModifiedAttributesListAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "pnpgraph_present", Column(&ServicesTable::PnpgraphPresentAccessor, objectAccessor));
|
table->AddColumn(prefix + "pnpgraph_present", Column(&ServicesTable::PnpgraphPresentAccessor, objectAccessor));
|
||||||
|
table->AddColumn(prefix + "staleness", Column(&ServicesTable::StalenessAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "check_interval", Column(&ServicesTable::CheckIntervalAccessor, objectAccessor));
|
table->AddColumn(prefix + "check_interval", Column(&ServicesTable::CheckIntervalAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "retry_interval", Column(&ServicesTable::RetryIntervalAccessor, objectAccessor));
|
table->AddColumn(prefix + "retry_interval", Column(&ServicesTable::RetryIntervalAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "notification_interval", Column(&ServicesTable::NotificationIntervalAccessor, objectAccessor));
|
table->AddColumn(prefix + "notification_interval", Column(&ServicesTable::NotificationIntervalAccessor, objectAccessor));
|
||||||
|
@ -650,6 +651,16 @@ Value ServicesTable::PnpgraphPresentAccessor(const Value& row)
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value ServicesTable::StalenessAccessor(const Value& row)
|
||||||
|
{
|
||||||
|
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||||
|
|
||||||
|
if (service->HasBeenChecked() && service->GetLastCheck() > 0)
|
||||||
|
return (Utility::GetTime() - service->GetLastCheck()) / (service->GetCheckInterval() * 3600);
|
||||||
|
|
||||||
|
return Empty;
|
||||||
|
}
|
||||||
|
|
||||||
Value ServicesTable::CheckIntervalAccessor(const Value& row)
|
Value ServicesTable::CheckIntervalAccessor(const Value& row)
|
||||||
{
|
{
|
||||||
return (static_cast<Service::Ptr>(row)->GetCheckInterval() / 60.0);
|
return (static_cast<Service::Ptr>(row)->GetCheckInterval() / 60.0);
|
||||||
|
|
|
@ -105,6 +105,7 @@ protected:
|
||||||
static Value ModifiedAttributesAccessor(const Value& row);
|
static Value ModifiedAttributesAccessor(const Value& row);
|
||||||
static Value ModifiedAttributesListAccessor(const Value& row);
|
static Value ModifiedAttributesListAccessor(const Value& row);
|
||||||
static Value PnpgraphPresentAccessor(const Value& row);
|
static Value PnpgraphPresentAccessor(const Value& row);
|
||||||
|
static Value StalenessAccessor(const Value& row);
|
||||||
static Value CheckIntervalAccessor(const Value& row);
|
static Value CheckIntervalAccessor(const Value& row);
|
||||||
static Value RetryIntervalAccessor(const Value& row);
|
static Value RetryIntervalAccessor(const Value& row);
|
||||||
static Value NotificationIntervalAccessor(const Value& row);
|
static Value NotificationIntervalAccessor(const Value& row);
|
||||||
|
|
Loading…
Reference in New Issue