2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2012-05-10 12:06:41 +02:00
|
|
|
|
2013-09-25 07:31:46 +02:00
|
|
|
#ifndef EXTERNALCOMMANDLISTENER_H
|
|
|
|
#define EXTERNALCOMMANDLISTENER_H
|
2012-04-24 07:16:34 +02:00
|
|
|
|
2018-01-18 13:50:38 +01:00
|
|
|
#include "compat/externalcommandlistener-ti.hpp"
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/objectlock.hpp"
|
|
|
|
#include "base/timer.hpp"
|
|
|
|
#include "base/utility.hpp"
|
2017-11-21 12:12:58 +01:00
|
|
|
#include <thread>
|
2013-03-17 20:19:29 +01:00
|
|
|
#include <iostream>
|
2013-03-16 21:18:53 +01:00
|
|
|
|
2012-04-24 07:16:34 +02:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-05-15 16:24:04 +02:00
|
|
|
/**
|
2012-06-27 18:43:34 +02:00
|
|
|
* @ingroup compat
|
2012-05-15 16:24:04 +02:00
|
|
|
*/
|
2018-01-04 06:11:04 +01:00
|
|
|
class ExternalCommandListener final : public ObjectImpl<ExternalCommandListener>
|
2012-04-24 07:16:34 +02:00
|
|
|
{
|
2012-06-27 18:43:34 +02:00
|
|
|
public:
|
2014-11-03 00:44:04 +01:00
|
|
|
DECLARE_OBJECT(ExternalCommandListener);
|
|
|
|
DECLARE_OBJECTNAME(ExternalCommandListener);
|
2013-07-09 08:42:08 +02:00
|
|
|
|
2015-02-07 22:36:17 +01:00
|
|
|
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
2014-02-17 16:34:18 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
protected:
|
2018-01-04 05:12:56 +01:00
|
|
|
void Start(bool runtimeCreated) override;
|
|
|
|
void Stop(bool runtimeRemoved) override;
|
2012-06-27 18:43:34 +02:00
|
|
|
|
|
|
|
private:
|
2013-01-22 08:47:56 +01:00
|
|
|
#ifndef _WIN32
|
2017-11-21 12:12:58 +01:00
|
|
|
std::thread m_CommandThread;
|
2012-06-27 18:43:34 +02:00
|
|
|
|
2013-01-22 08:47:56 +01:00
|
|
|
void CommandPipeThread(const String& commandPath);
|
|
|
|
#endif /* _WIN32 */
|
2012-04-24 07:16:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-09-25 07:31:46 +02:00
|
|
|
#endif /* EXTERNALCOMMANDLISTENER_H */
|