From 2d5112c878819385b732e79fc6707c7d1ef79078 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 5 Feb 2015 15:17:56 +0100 Subject: [PATCH] Send check result even when accept_commands is not set fixes #8333 --- lib/icinga/apievents.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp index aea37840e..53048524e 100644 --- a/lib/icinga/apievents.cpp +++ b/lib/icinga/apievents.cpp @@ -1525,6 +1525,21 @@ Value ApiEvents::ExecuteCommandAPIHandler(const MessageOrigin& origin, const Dic if (!listener->GetAcceptCommands()) { Log(LogWarning, "ApiListener") << "Ignoring command. '" << listener->GetName() << "' does not accept commands."; + + Host::Ptr host = new Host(); + Dictionary::Ptr attrs = new Dictionary(); + + attrs->Set("__name", params->Get("host")); + attrs->Set("type", "Host"); + + Deserialize(host, attrs, false, FAConfig); + + CheckResult::Ptr cr = new CheckResult(); + cr->SetState(ServiceUnknown); + cr->SetOutput("'" + listener->GetName() + "' does not accept commands."); + Dictionary::Ptr message = MakeCheckResultMessage(host, cr); + listener->SyncSendMessage(endpoint, message); + return Empty; }