mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
parent
731ee15d4d
commit
d20ee37196
@ -130,7 +130,8 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
|
|||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
|
|
||||||
try {
|
try {
|
||||||
wi.Callback();
|
if (wi.Callback)
|
||||||
|
wi.Callback();
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "Exception thrown in event handler: " << std::endl
|
msgbuf << "Exception thrown in event handler: " << std::endl
|
||||||
|
@ -48,5 +48,16 @@ void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable)
|
|||||||
resolvers.push_back(std::make_pair("command", commandObj));
|
resolvers.push_back(std::make_pair("command", commandObj));
|
||||||
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance()));
|
||||||
|
|
||||||
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), resolvers);
|
PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), resolvers, boost::bind(&PluginEventTask::ProcessFinishedHandler, checkable, _1, _2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginEventTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr)
|
||||||
|
{
|
||||||
|
if (pr.ExitStatus != 0) {
|
||||||
|
std::ostringstream msgbuf;
|
||||||
|
msgbuf << "Event command '" << command << "' for object '"
|
||||||
|
<< checkable->GetName() << "' failed; exit status: "
|
||||||
|
<< pr.ExitStatus << ", output: " << pr.Output;
|
||||||
|
Log(LogWarning, "PluginEventTask", msgbuf.str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "methods/i2-methods.hpp"
|
#include "methods/i2-methods.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
|
#include "base/process.hpp"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -38,6 +39,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PluginEventTask(void);
|
PluginEventTask(void);
|
||||||
|
|
||||||
|
static void ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user