icinga2/cib/service.h

87 lines
2.0 KiB
C
Raw Normal View History

#ifndef SERVICE_H
#define SERVICE_H
namespace icinga
{
2012-06-25 15:42:46 +02:00
enum ServiceState
{
StateOK,
StateWarning,
StateCritical,
2012-06-27 18:43:34 +02:00
StateUnknown,
2012-06-25 15:42:46 +02:00
StateUnreachable,
StateUncheckable,
};
enum ServiceStateType
{
2012-06-27 18:43:34 +02:00
StateTypeSoft,
StateTypeHard
2012-06-25 15:42:46 +02:00
};
2012-07-01 13:21:49 +02:00
class CheckResult;
class I2_ICINGA_API Service : public ConfigObjectAdapter
{
public:
Service(const ConfigObject::Ptr& configObject)
: ConfigObjectAdapter(configObject)
{ }
2012-06-30 13:39:55 +02:00
static bool Exists(const string& name);
static Service GetByName(const string& name);
2012-06-27 18:43:34 +02:00
2012-06-28 14:24:41 +02:00
string GetAlias(void) const;
Host GetHost(void) const;
Dictionary::Ptr GetMacros(void) const;
string GetCheckType(void) const;
string GetCheckCommand(void) const;
long GetMaxCheckAttempts(void) const;
long GetCheckInterval(void) const;
long GetRetryInterval(void) const;
long GetFreshnessInterval(void) const;
2012-06-27 18:43:34 +02:00
Dictionary::Ptr GetDependencies(void) const;
2012-06-30 13:39:55 +02:00
Dictionary::Ptr GetGroups(void) const;
2012-07-02 16:19:43 +02:00
Dictionary::Ptr GetCheckers(void) const;
void SetNextCheck(time_t nextCheck);
time_t GetNextCheck(void);
2012-06-27 18:43:34 +02:00
void UpdateNextCheck(void);
2012-06-25 15:42:46 +02:00
void SetChecker(const string& checker);
string GetChecker(void) const;
bool IsAllowedChecker(const string& checker) const;
2012-06-27 18:43:34 +02:00
2012-06-25 15:42:46 +02:00
void SetCurrentCheckAttempt(long attempt);
long GetCurrentCheckAttempt(void) const;
void SetState(ServiceState state);
ServiceState GetState(void) const;
void SetStateType(ServiceStateType type);
ServiceStateType GetStateType(void) const;
2012-06-27 18:43:34 +02:00
void SetLastCheckResult(const Dictionary::Ptr& result);
Dictionary::Ptr GetLastCheckResult(void) const;
void SetLastStateChange(time_t ts);
time_t GetLastStateChange(void) const;
void SetLastHardStateChange(time_t ts);
time_t GetLastHardStateChange(void) const;
void ApplyCheckResult(const CheckResult& cr);
2012-06-27 18:43:34 +02:00
static ServiceState StateFromString(const string& state);
2012-06-27 18:43:34 +02:00
static string StateToString(ServiceState state);
static ServiceStateType StateTypeFromString(const string& state);
2012-06-27 18:43:34 +02:00
static string StateTypeToString(ServiceStateType state);
};
}
#endif /* SERVICE_H */