Livestatus: Add 'check_source' to hosts table.

Fixes #6185
This commit is contained in:
Michael Friedrich 2014-05-10 21:57:01 +02:00
parent d13871e233
commit 7a4fa25a49
4 changed files with 22 additions and 0 deletions

View File

@ -157,6 +157,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
table->AddColumn(prefix + "services", Column(&HostsTable::ServicesAccessor, objectAccessor));
table->AddColumn(prefix + "services_with_state", Column(&HostsTable::ServicesWithStateAccessor, objectAccessor));
table->AddColumn(prefix + "services_with_info", Column(&HostsTable::ServicesWithInfoAccessor, objectAccessor));
table->AddColumn(prefix + "check_source", Column(&HostsTable::CheckSourceAccessor, objectAccessor));
table->AddColumn(prefix + "is_reachable", Column(&HostsTable::IsReachableAccessor, objectAccessor));
}
@ -1483,6 +1484,21 @@ Value HostsTable::ServicesWithInfoAccessor(const Value& row)
return services;
}
Value HostsTable::CheckSourceAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
if (!host)
return Empty;
CheckResult::Ptr cr = host->GetLastCheckResult();
if (cr)
return cr->GetCheckSource();
return Empty;
}
Value HostsTable::IsReachableAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);

View File

@ -140,6 +140,7 @@ protected:
static Value ServicesAccessor(const Value& row);
static Value ServicesWithStateAccessor(const Value& row);
static Value ServicesWithInfoAccessor(const Value& row);
static Value CheckSourceAccessor(const Value& row);
static Value IsReachableAccessor(const Value& row);
};

View File

@ -505,6 +505,7 @@ New columns:
----------|--------------
hosts | is_reachable
services | is_reachable
hosts | check_source
services | check_source
downtimes | triggers
downtimes | trigger_time

View File

@ -0,0 +1,4 @@
GET hosts
Columns: name plugin_output check_source
ResponseHeader: fixed16