ClusterEvents::ExecuteCheckFromQueue(): take ApiListener::Ptr

This commit is contained in:
Alexander A. Klimov 2025-04-02 14:53:36 +02:00
parent 9b82505295
commit 0c91e8f09b
3 changed files with 5 additions and 4 deletions

View File

@ -551,7 +551,7 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
return Result::Ok;
}
void Checkable::ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros)
void Checkable::ExecuteRemoteCheck(const ApiListener::Ptr& listener, const Dictionary::Ptr& resolvedMacros)
{
CONTEXT("Executing remote check for object '" << GetName() << "'");
@ -562,7 +562,7 @@ void Checkable::ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros)
cr->SetScheduleStart(scheduled_start);
cr->SetExecutionStart(before_check);
GetCheckCommand()->Execute(this, cr, resolvedMacros, true);
GetCheckCommand()->Execute(this, cr, listener, resolvedMacros, true);
}
void Checkable::ExecuteCheck(const CheckResultProducer::Ptr& producer)

View File

@ -12,6 +12,7 @@
#include "icinga/notification.hpp"
#include "icinga/comment.hpp"
#include "icinga/downtime.hpp"
#include "remote/apilistener.hpp"
#include "remote/crproducer.hpp"
#include "remote/endpoint.hpp"
#include "remote/messageorigin.hpp"
@ -111,7 +112,7 @@ public:
static void UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type);
void ExecuteRemoteCheck(const Dictionary::Ptr& resolvedMacros = nullptr);
void ExecuteRemoteCheck(const ApiListener::Ptr& listener, const Dictionary::Ptr& resolvedMacros = nullptr);
void ExecuteCheck(const CheckResultProducer::Ptr& producer);
enum class ProcessingResult

View File

@ -279,7 +279,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
if (command_type == "check_command") {
try {
host->ExecuteRemoteCheck(macros);
host->ExecuteRemoteCheck(ApiListener::GetInstance(), macros);
} catch (const std::exception& ex) {
String output = "Exception occurred while checking '" + host->GetName() + "': " + DiagnosticInformation(ex);
ServiceState state = ServiceUnknown;