mirror of https://github.com/Icinga/icinga2.git
Make checkers configurable.
This commit is contained in:
parent
45fef3573c
commit
40350bfce8
|
@ -107,6 +107,13 @@ Dictionary::Ptr Service::GetGroups(void) const
|
|||
return value;
|
||||
}
|
||||
|
||||
Dictionary::Ptr Service::GetCheckers(void) const
|
||||
{
|
||||
Dictionary::Ptr value;
|
||||
GetConfigObject()->GetProperty("checkers", &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void Service::SetNextCheck(time_t nextCheck)
|
||||
{
|
||||
GetConfigObject()->SetTag("next_check", (long)nextCheck);
|
||||
|
@ -302,6 +309,19 @@ string Service::StateTypeToString(ServiceStateType type)
|
|||
|
||||
bool Service::IsAllowedChecker(const string& checker) const
|
||||
{
|
||||
/* TODO: check config */
|
||||
return true;
|
||||
Dictionary::Ptr checkers = GetCheckers();
|
||||
|
||||
if (!checkers)
|
||||
return true;
|
||||
|
||||
Dictionary::Iterator it;
|
||||
for (it = checkers->Begin(); it != checkers->End(); it++) {
|
||||
string pattern = it->second;
|
||||
|
||||
if (Utility::Match(pattern, checker))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
long GetFreshnessInterval(void) const;
|
||||
Dictionary::Ptr GetDependencies(void) const;
|
||||
Dictionary::Ptr GetGroups(void) const;
|
||||
Dictionary::Ptr GetCheckers(void) const;
|
||||
|
||||
void SetNextCheck(time_t nextCheck);
|
||||
time_t GetNextCheck(void);
|
||||
|
|
|
@ -47,6 +47,7 @@ void CompatComponent::Start(void)
|
|||
m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this));
|
||||
m_StatusTimer->Start();
|
||||
|
||||
CIB::RequireInformation(CIB_Configuration);
|
||||
CIB::RequireInformation(CIB_ProgramStatus);
|
||||
CIB::RequireInformation(CIB_ServiceStatus);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue