2012-06-13 13:42:55 +02:00
|
|
|
#ifndef NAGIOSCHECKTASK_H
|
|
|
|
#define NAGIOSCHECKTASK_H
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-06-19 12:23:52 +02:00
|
|
|
class I2_ICINGA_API NagiosCheckTask : public CheckTask, public ThreadPoolTask
|
2012-06-13 13:42:55 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-06-19 09:38:20 +02:00
|
|
|
typedef shared_ptr<NagiosCheckTask> Ptr;
|
|
|
|
typedef weak_ptr<NagiosCheckTask> WeakPtr;
|
|
|
|
|
2012-06-13 13:42:55 +02:00
|
|
|
NagiosCheckTask(const Service& service);
|
|
|
|
|
2012-06-18 17:23:48 +02:00
|
|
|
virtual void Enqueue(void);
|
2012-06-17 20:35:56 +02:00
|
|
|
virtual CheckResult GetResult(void);
|
2012-06-13 13:42:55 +02:00
|
|
|
|
|
|
|
static CheckTask::Ptr CreateTask(const Service& service);
|
2012-06-18 17:23:48 +02:00
|
|
|
static void FlushQueue(void);
|
2012-06-19 09:38:20 +02:00
|
|
|
static void GetFinishedTasks(vector<CheckTask::Ptr>& tasks);
|
2012-06-13 13:42:55 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
string m_Command;
|
2012-06-19 09:38:20 +02:00
|
|
|
CheckResult m_Result;
|
2012-06-17 20:35:56 +02:00
|
|
|
|
2012-06-19 12:23:52 +02:00
|
|
|
static list<ThreadPoolTask::Ptr> m_QueuedTasks;
|
2012-06-18 17:23:48 +02:00
|
|
|
|
2012-06-19 09:38:20 +02:00
|
|
|
static boost::mutex m_FinishedTasksMutex;
|
|
|
|
static vector<CheckTask::Ptr> m_FinishedTasks;
|
|
|
|
|
2012-06-19 12:23:52 +02:00
|
|
|
virtual void Execute(void);
|
|
|
|
void RunCheck(void);
|
2012-06-13 13:42:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* NAGIOSCHECKTASK_H */
|