1
0
mirror of https://github.com/Icinga/icinga2.git synced 2025-04-08 17:05:25 +02:00

Set check source to node name as authority, if empty.

Fixes 
This commit is contained in:
Michael Friedrich 2014-03-20 10:32:52 +01:00
parent 8640e15188
commit f6067d357d
7 changed files with 6 additions and 9 deletions

@ -66,7 +66,6 @@ void ClusterCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult
cr->SetOutput(output);
cr->SetPerformanceData(perfdata);
cr->SetState(state);
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(cr);
}

@ -140,7 +140,6 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
result->SetState(PluginUtility::ExitStatusToState(Convert::ToLong(attrs["return_code"])));
result->SetExecutionStart(Convert::ToDouble(attrs["start_time"]));
result->SetExecutionEnd(Convert::ToDouble(attrs["finish_time"]));
result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(result);

@ -255,7 +255,6 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
result->SetExecutionStart(time);
result->SetExecutionEnd(time);
result->SetActive(false);
result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
Log(LogInformation, "icinga", "Processing passive check result for host '" + arguments[0] + "'");
hc->ProcessCheckResult(result);
@ -295,7 +294,6 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
result->SetExecutionStart(time);
result->SetExecutionEnd(time);
result->SetActive(false);
result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
Log(LogInformation, "icinga", "Processing passive check result for service '" + arguments[1] + "'");
service->ProcessCheckResult(result);

@ -241,8 +241,12 @@ void Service::ProcessCheckResult(const CheckResult::Ptr& cr, const String& autho
String check_source = cr->GetCheckSource();
if (check_source.IsEmpty())
cr->SetCheckSource(authority);
if (check_source.IsEmpty()) {
if (authority.IsEmpty())
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
else
cr->SetCheckSource(authority);
}
bool reachable = IsReachable();
bool notification_reachable = IsReachable(DependencyNotification);

@ -82,7 +82,6 @@ void IcingaCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult:
cr->SetOutput("Icinga 2 is running.");
cr->SetPerformanceData(perfdata);
cr->SetState(StateOK);
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(cr);
}

@ -86,7 +86,6 @@ void PluginCheckTask::ProcessFinishedHandler(const Service::Ptr& service, const
cr->SetExitStatus(pr.ExitStatus);
cr->SetExecutionStart(pr.ExecutionStart);
cr->SetExecutionEnd(pr.ExecutionEnd);
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(cr);
}

@ -42,7 +42,6 @@ void RandomCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult:
cr->SetOutput(output);
cr->SetPerformanceData(perfdata);
cr->SetState(static_cast<ServiceState>(Utility::Random() % 4));
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(cr);
}