2012-06-13 13:42:55 +02:00
|
|
|
#ifndef CHECKTASK_H
|
|
|
|
#define CHECKTASK_H
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
enum CheckState
|
|
|
|
{
|
|
|
|
StateOK,
|
|
|
|
StateWarning,
|
|
|
|
StateCritical,
|
|
|
|
StateUnreachable,
|
|
|
|
StateUncheckable,
|
|
|
|
StateUnknown
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CheckResult
|
|
|
|
{
|
|
|
|
time_t StartTime;
|
|
|
|
time_t EndTime;
|
|
|
|
|
|
|
|
CheckState State;
|
|
|
|
string Output;
|
|
|
|
Dictionary::Ptr PerformanceData;
|
|
|
|
};
|
|
|
|
|
2012-06-14 11:18:20 +02:00
|
|
|
class I2_ICINGA_API CheckTask : public Object
|
2012-06-13 13:42:55 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef shared_ptr<CheckTask> Ptr;
|
|
|
|
typedef weak_ptr<CheckTask> WeakPtr;
|
|
|
|
|
|
|
|
typedef function<CheckTask::Ptr(const Service&)> Factory;
|
|
|
|
|
2012-06-17 20:35:56 +02:00
|
|
|
virtual void Execute(void) = 0;
|
|
|
|
virtual bool IsFinished(void) const = 0;
|
|
|
|
virtual CheckResult GetResult(void) = 0;
|
2012-06-13 13:42:55 +02:00
|
|
|
|
|
|
|
static void RegisterType(string type, Factory factory);
|
|
|
|
static CheckTask::Ptr CreateTask(const Service& service);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static map<string, Factory> m_Types;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CHECKTASK_H */
|