mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7310 from Icinga/bugfix/icinga-app-null
DB IDO: Fix possible crash with program status updates before IcingaApplication is loaded
This commit is contained in:
commit
78867313fe
|
@ -132,6 +132,11 @@ void DbConnection::InsertRuntimeVariable(const String& key, const Value& value)
|
||||||
|
|
||||||
void DbConnection::UpdateProgramStatus()
|
void DbConnection::UpdateProgramStatus()
|
||||||
{
|
{
|
||||||
|
IcingaApplication::Ptr icingaApplication = IcingaApplication::GetInstance();
|
||||||
|
|
||||||
|
if (!icingaApplication)
|
||||||
|
return;
|
||||||
|
|
||||||
Log(LogNotice, "DbConnection")
|
Log(LogNotice, "DbConnection")
|
||||||
<< "Updating programstatus table.";
|
<< "Updating programstatus table.";
|
||||||
|
|
||||||
|
@ -149,18 +154,18 @@ void DbConnection::UpdateProgramStatus()
|
||||||
{ "status_update_time", DbValue::FromTimestamp(Utility::GetTime()) },
|
{ "status_update_time", DbValue::FromTimestamp(Utility::GetTime()) },
|
||||||
{ "program_start_time", DbValue::FromTimestamp(Application::GetStartTime()) },
|
{ "program_start_time", DbValue::FromTimestamp(Application::GetStartTime()) },
|
||||||
{ "is_currently_running", 1 },
|
{ "is_currently_running", 1 },
|
||||||
{ "endpoint_name", IcingaApplication::GetInstance()->GetNodeName() },
|
{ "endpoint_name", icingaApplication->GetNodeName() },
|
||||||
{ "process_id", Utility::GetPid() },
|
{ "process_id", Utility::GetPid() },
|
||||||
{ "daemon_mode", 1 },
|
{ "daemon_mode", 1 },
|
||||||
{ "last_command_check", DbValue::FromTimestamp(Utility::GetTime()) },
|
{ "last_command_check", DbValue::FromTimestamp(Utility::GetTime()) },
|
||||||
{ "notifications_enabled", (IcingaApplication::GetInstance()->GetEnableNotifications() ? 1 : 0) },
|
{ "notifications_enabled", (icingaApplication->GetEnableNotifications() ? 1 : 0) },
|
||||||
{ "active_host_checks_enabled", (IcingaApplication::GetInstance()->GetEnableHostChecks() ? 1 : 0) },
|
{ "active_host_checks_enabled", (icingaApplication->GetEnableHostChecks() ? 1 : 0) },
|
||||||
{ "passive_host_checks_enabled", 1 },
|
{ "passive_host_checks_enabled", 1 },
|
||||||
{ "active_service_checks_enabled", (IcingaApplication::GetInstance()->GetEnableServiceChecks() ? 1 : 0) },
|
{ "active_service_checks_enabled", (icingaApplication->GetEnableServiceChecks() ? 1 : 0) },
|
||||||
{ "passive_service_checks_enabled", 1 },
|
{ "passive_service_checks_enabled", 1 },
|
||||||
{ "event_handlers_enabled", (IcingaApplication::GetInstance()->GetEnableEventHandlers() ? 1 : 0) },
|
{ "event_handlers_enabled", (icingaApplication->GetEnableEventHandlers() ? 1 : 0) },
|
||||||
{ "flap_detection_enabled", (IcingaApplication::GetInstance()->GetEnableFlapping() ? 1 : 0) },
|
{ "flap_detection_enabled", (icingaApplication->GetEnableFlapping() ? 1 : 0) },
|
||||||
{ "process_performance_data", (IcingaApplication::GetInstance()->GetEnablePerfdata() ? 1 : 0) }
|
{ "process_performance_data", (icingaApplication->GetEnablePerfdata() ? 1 : 0) }
|
||||||
});
|
});
|
||||||
|
|
||||||
query1.WhereCriteria = new Dictionary({
|
query1.WhereCriteria = new Dictionary({
|
||||||
|
|
Loading…
Reference in New Issue