mirror of https://github.com/Icinga/icinga2.git
parent
a3db18f2e2
commit
1279d27720
|
@ -295,7 +295,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
|||
fp << "\t" << "initial_state" "\t" "o" "\n"
|
||||
"\t" "low_flap_threshold" "\t" << hc->GetFlappingThreshold() << "\n"
|
||||
"\t" "high_flap_threshold" "\t" << hc->GetFlappingThreshold() << "\n"
|
||||
"\t" "process_perf_data" "\t" "1" "\n"
|
||||
"\t" "process_perf_data" "\t" << CompatUtility::GetServiceProcessPerformanceData(hc) << "\n"
|
||||
"\t" "check_freshness" "\t" "1" "\n";
|
||||
|
||||
} else {
|
||||
|
@ -467,7 +467,7 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
|
|||
fp << "\t" "initial_state" "\t" "o" "\n"
|
||||
"\t" "low_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
|
||||
"\t" "high_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
|
||||
"\t" "process_perf_data" "\t" "1" "\n"
|
||||
"\t" "process_perf_data" "\t" << CompatUtility::GetServiceProcessPerformanceData(service) << "\n"
|
||||
"\t" "check_freshness" << "\t" "1" "\n";
|
||||
if (!notes.IsEmpty())
|
||||
fp << "\t" "notes" "\t" << notes << "\n";
|
||||
|
|
|
@ -73,7 +73,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
|||
table->AddColumn(prefix + "max_check_attempts", Column(&HostsTable::MaxCheckAttemptsAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "flap_detection_enabled", Column(&HostsTable::FlapDetectionEnabledAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "check_freshness", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&Table::ZeroAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "accept_passive_checks", Column(&HostsTable::AcceptPassiveChecksAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "event_handler_enabled", Column(&HostsTable::EventHandlerEnabledAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "acknowledgement_type", Column(&HostsTable::AcknowledgementTypeAccessor, objectAccessor));
|
||||
|
@ -435,25 +435,9 @@ Value HostsTable::PluginOutputAccessor(const Value& row)
|
|||
return output;
|
||||
}
|
||||
|
||||
Value HostsTable::PerfDataAccessor(const Value& row)
|
||||
Value HostsTable::PerfDataAccessor(const Value&)
|
||||
{
|
||||
/* use hostcheck service */
|
||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||
|
||||
if (!host)
|
||||
return Empty;
|
||||
|
||||
Service::Ptr hc = host->GetCheckService();
|
||||
String perfdata;
|
||||
|
||||
if (hc) {
|
||||
CheckResult::Ptr cr = hc->GetLastCheckResult();
|
||||
|
||||
if (cr)
|
||||
perfdata = CompatUtility::GetCheckResultPerfdata(cr);
|
||||
}
|
||||
|
||||
return perfdata;
|
||||
return Empty;
|
||||
}
|
||||
|
||||
Value HostsTable::IconImageAccessor(const Value& row)
|
||||
|
|
|
@ -92,7 +92,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
|
|||
table->AddColumn(prefix + "accept_passive_checks", Column(&ServicesTable::AcceptPassiveChecksAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "event_handler_enabled", Column(&ServicesTable::EventHandlerEnabledAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "notifications_enabled", Column(&ServicesTable::NotificationsEnabledAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&ServicesTable::ProcessPerformanceDataAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "is_executing", Column(&Table::ZeroAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "active_checks_enabled", Column(&ServicesTable::ActiveChecksEnabledAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "check_options", Column(&ServicesTable::CheckOptionsAccessor, objectAccessor));
|
||||
|
@ -693,6 +693,16 @@ Value ServicesTable::NotificationsEnabledAccessor(const Value& row)
|
|||
return CompatUtility::GetServiceNotificationsEnabled(service);
|
||||
}
|
||||
|
||||
Value ServicesTable::ProcessPerformanceDataAccessor(const Value& row)
|
||||
{
|
||||
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||
|
||||
if (!service)
|
||||
return Empty;
|
||||
|
||||
return CompatUtility::GetServiceProcessPerformanceData(service);
|
||||
}
|
||||
|
||||
Value ServicesTable::ActiveChecksEnabledAccessor(const Value& row)
|
||||
{
|
||||
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||
|
|
|
@ -94,6 +94,7 @@ protected:
|
|||
static Value AcceptPassiveChecksAccessor(const Value& row);
|
||||
static Value EventHandlerEnabledAccessor(const Value& row);
|
||||
static Value NotificationsEnabledAccessor(const Value& row);
|
||||
static Value ProcessPerformanceDataAccessor(const Value& row);
|
||||
static Value ActiveChecksEnabledAccessor(const Value& row);
|
||||
static Value CheckOptionsAccessor(const Value& row);
|
||||
static Value FlapDetectionEnabledAccessor(const Value& row);
|
||||
|
|
|
@ -79,7 +79,7 @@ void StatusTable::AddColumns(Table *table, const String& prefix,
|
|||
table->AddColumn(prefix + "check_service_freshness", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "check_host_freshness", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "enable_flap_detection", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "process_performance_data", Column(&StatusTable::ProcessPerformanceDataAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "check_external_commands", Column(&Table::OneAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "program_start", Column(&StatusTable::ProgramStartAccessor, objectAccessor));
|
||||
table->AddColumn(prefix + "last_command_check", Column(&Table::ZeroAccessor, objectAccessor));
|
||||
|
@ -148,6 +148,11 @@ Value StatusTable::NagiosPidAccessor(const Value& row)
|
|||
return Utility::GetPid();
|
||||
}
|
||||
|
||||
Value StatusTable::ProcessPerformanceDataAccessor(const Value&)
|
||||
{
|
||||
return (IcingaApplication::GetInstance()->GetEnablePerfdata() ? 1 : 0);
|
||||
}
|
||||
|
||||
Value StatusTable::ProgramStartAccessor(const Value& row)
|
||||
{
|
||||
return static_cast<long>(Application::GetStartTime());
|
||||
|
|
|
@ -52,6 +52,7 @@ protected:
|
|||
static Value ExternalCommandsAccessor(const Value& row);
|
||||
static Value ExternalCommandsRateAccessor(const Value& row);
|
||||
static Value NagiosPidAccessor(const Value& row);
|
||||
static Value ProcessPerformanceDataAccessor(const Value& row);
|
||||
static Value ProgramStartAccessor(const Value& row);
|
||||
static Value NumHostsAccessor(const Value& row);
|
||||
static Value NumServicesAccessor(const Value& row);
|
||||
|
|
|
@ -100,7 +100,7 @@ void DbConnection::ProgramStatusHandler(void)
|
|||
query2.Fields->Set("event_handlers_enabled", 1);
|
||||
query2.Fields->Set("flap_detection_enabled", 1);
|
||||
query2.Fields->Set("failure_prediction_enabled", 1);
|
||||
query2.Fields->Set("process_performance_data", 1);
|
||||
query2.Fields->Set("process_performance_data", (IcingaApplication::GetInstance()->GetEnablePerfdata() ? 1 : 0));
|
||||
DbObject::OnQuery(query2);
|
||||
|
||||
DbQuery query3;
|
||||
|
|
Loading…
Reference in New Issue