Merge pull request #8158 from Icinga/bugfix/check-source-passive-7948

Checkable#ProcessCheckResult(): don't overwrite check source
This commit is contained in:
Julian Brost 2021-01-26 10:49:55 +01:00 committed by GitHub
commit 9219f68c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -118,14 +118,16 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (cr->GetExecutionEnd() == 0)
cr->SetExecutionEnd(now);
if (!origin || origin->IsLocal())
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
Endpoint::Ptr command_endpoint = GetCommandEndpoint();
/* override check source if command_endpoint was defined */
if (command_endpoint && !GetExtension("agent_check"))
cr->SetCheckSource(command_endpoint->GetName());
if (cr->GetCheckSource().IsEmpty()) {
if ((!origin || origin->IsLocal()))
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
/* override check source if command_endpoint was defined */
if (command_endpoint && !GetExtension("agent_check"))
cr->SetCheckSource(command_endpoint->GetName());
}
/* agent checks go through the api */
if (command_endpoint && GetExtension("agent_check")) {