From c3eba7e88da4614c7eb6b4e9fd680dbbf9a264e4 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 25 Jan 2021 16:05:03 +0100 Subject: [PATCH] Checkable#ProcessCheckResult(): don't overwrite check source ... set by passive check results. refs #7948 --- lib/icinga/checkable-check.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index da1e8bd39..d4b97e3b1 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -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")) {