mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
ExternalCommandProcessor::RegisterCommand(): allow callback to take a CheckResultProducer::Ptr
This commit is contained in:
parent
ade302a08b
commit
8dfa24fcec
@ -115,6 +115,16 @@ void ExternalCommandProcessor::RegisterCommand(const String& command, const Exte
|
|||||||
GetCommands()[command] = eci;
|
GetCommands()[command] = eci;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExternalCommandProcessor::RegisterCommand(const String& command, const ExternalCommandCallbackLite& callback, size_t minArgs, size_t maxArgs)
|
||||||
|
{
|
||||||
|
RegisterCommand(
|
||||||
|
command,
|
||||||
|
[callback](const CheckResultProducer::Ptr&, double time, const std::vector<String>& args) { callback(time, args); },
|
||||||
|
minArgs,
|
||||||
|
maxArgs
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::RegisterCommands()
|
void ExternalCommandProcessor::RegisterCommands()
|
||||||
{
|
{
|
||||||
RegisterCommand("PROCESS_HOST_CHECK_RESULT", &ExternalCommandProcessor::ProcessHostCheckResult, 3);
|
RegisterCommand("PROCESS_HOST_CHECK_RESULT", &ExternalCommandProcessor::ProcessHostCheckResult, 3);
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::function<void (double, const std::vector<String>& arguments)> ExternalCommandCallback;
|
typedef std::function<void(const CheckResultProducer::Ptr&, double, const std::vector<String>& arguments)> ExternalCommandCallback;
|
||||||
|
typedef std::function<void(double, const std::vector<String>& arguments)> ExternalCommandCallbackLite;
|
||||||
|
|
||||||
struct ExternalCommandInfo
|
struct ExternalCommandInfo
|
||||||
{
|
{
|
||||||
@ -158,6 +159,7 @@ private:
|
|||||||
static void ChangeCustomCommandVarInternal(const Command::Ptr& command, const String& name, const Value& value);
|
static void ChangeCustomCommandVarInternal(const Command::Ptr& command, const String& name, const Value& value);
|
||||||
|
|
||||||
static void RegisterCommand(const String& command, const ExternalCommandCallback& callback, size_t minArgs = 0, size_t maxArgs = UINT_MAX);
|
static void RegisterCommand(const String& command, const ExternalCommandCallback& callback, size_t minArgs = 0, size_t maxArgs = UINT_MAX);
|
||||||
|
static void RegisterCommand(const String& command, const ExternalCommandCallbackLite& callback, size_t minArgs = 0, size_t maxArgs = UINT_MAX);
|
||||||
static void RegisterCommands();
|
static void RegisterCommands();
|
||||||
|
|
||||||
static std::mutex& GetMutex();
|
static std::mutex& GetMutex();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user