Currently this is `null` which isn't really correct.
As otherwise, it is tremendously hard to figure out which check
command was involved, if you're not looking at the `.check_command`
checkable object.
#include "icinga/cib.hpp"
#include "icinga/service.hpp"
#include "icinga/icingaapplication.hpp"
+#include "icinga/checkcommand.hpp"
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
if (resolvedMacros && !useResolvedMacros)
return;
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
+ cr->SetCommand(command->GetName());
+
ApiListener::Ptr listener = ApiListener::GetInstance();
if (!listener) {
return;
}
- CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
- Value raw_command = commandObj->GetCommandLine();
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
+ Value raw_command = command->GetCommandLine();
Host::Ptr host;
Service::Ptr service;
if (service)
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
- resolvers.emplace_back("command", commandObj);
+ resolvers.emplace_back("command", command);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
String zoneName = MacroProcessor::ResolveMacros("$cluster_zone$", resolvers, checkable->GetLastCheckResult(),
if (resolvedMacros && !useResolvedMacros)
return;
+ cr->SetCommand(command->GetName());
+
if (zoneName.IsEmpty()) {
cr->SetOutput("Macro 'cluster_zone' must be set.");
cr->SetState(ServiceUnknown);
REQUIRE_NOT_NULL(checkable);
REQUIRE_NOT_NULL(cr);
- CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
Host::Ptr host;
Service::Ptr service;
if (service)
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
- resolvers.emplace_back("command", commandObj);
+ resolvers.emplace_back("command", command);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
int dummyState = MacroProcessor::ResolveMacros("$dummy_state$", resolvers, checkable->GetLastCheckResult(),
cr->SetExitStatus(dummyState);
cr->SetExecutionStart(now);
cr->SetExecutionEnd(now);
+ cr->SetCommand(command->GetName());
checkable->ProcessCheckResult(cr);
}
REQUIRE_NOT_NULL(checkable);
REQUIRE_NOT_NULL(cr);
- CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
Host::Ptr host;
Service::Ptr service;
if (service)
resolvers.emplace_back("service", service);
resolvers.emplace_back("host", host);
- resolvers.emplace_back("command", commandObj);
+ resolvers.emplace_back("command", command);
resolvers.emplace_back("icinga", IcingaApplication::GetInstance());
String missingIcingaMinVersion;
}
cr->SetOutput(output);
+ cr->SetCommand(command->GetName());
checkable->ProcessCheckResult(cr);
}
#endif /* _WIN32 */
#include "methods/randomchecktask.hpp"
#include "icinga/icingaapplication.hpp"
+#include "icinga/checkcommand.hpp"
#include "base/utility.hpp"
#include "base/perfdatavalue.hpp"
#include "base/function.hpp"
cr->SetState(static_cast<ServiceState>(Utility::Random() % 4));
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
+ cr->SetCommand(command->GetName());
+
checkable->ProcessCheckResult(cr);
}
cr->SetExecutionStart(now);
cr->SetExecutionEnd(now);
+ CheckCommand::Ptr command = checkable->GetCheckCommand();
+ cr->SetCommand(command->GetName());
+
checkable->ProcessCheckResult(cr);
}
\ No newline at end of file