icinga2/lib/compat/externalcommandlistener.hpp

42 lines
871 B
C++
Raw Normal View History

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2013-09-25 07:31:46 +02:00
#ifndef EXTERNALCOMMANDLISTENER_H
#define EXTERNALCOMMANDLISTENER_H
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
namespace icinga
{
/**
2012-06-27 18:43:34 +02:00
* @ingroup compat
*/
2018-01-04 06:11:04 +01:00
class ExternalCommandListener final : public ObjectImpl<ExternalCommandListener>
{
2012-06-27 18:43:34 +02:00
public:
2014-11-03 00:44:04 +01:00
DECLARE_OBJECT(ExternalCommandListener);
DECLARE_OBJECTNAME(ExternalCommandListener);
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
protected:
void Start(bool runtimeCreated) override;
void Stop(bool runtimeRemoved) override;
2012-06-27 18:43:34 +02:00
private:
#ifndef _WIN32
2017-11-21 12:12:58 +01:00
std::thread m_CommandThread;
2012-06-27 18:43:34 +02:00
void CommandPipeThread(const String& commandPath);
#endif /* _WIN32 */
};
}
2013-09-25 07:31:46 +02:00
#endif /* EXTERNALCOMMANDLISTENER_H */