Make checkers configurable.

This commit is contained in:
Gunnar Beutner 2012-07-02 16:19:43 +02:00
parent 45fef3573c
commit 40350bfce8
3 changed files with 24 additions and 2 deletions

View File

@ -107,6 +107,13 @@ Dictionary::Ptr Service::GetGroups(void) const
return value; return value;
} }
Dictionary::Ptr Service::GetCheckers(void) const
{
Dictionary::Ptr value;
GetConfigObject()->GetProperty("checkers", &value);
return value;
}
void Service::SetNextCheck(time_t nextCheck) void Service::SetNextCheck(time_t nextCheck)
{ {
GetConfigObject()->SetTag("next_check", (long)nextCheck); GetConfigObject()->SetTag("next_check", (long)nextCheck);
@ -302,6 +309,19 @@ string Service::StateTypeToString(ServiceStateType type)
bool Service::IsAllowedChecker(const string& checker) const bool Service::IsAllowedChecker(const string& checker) const
{ {
/* TODO: check config */ Dictionary::Ptr checkers = GetCheckers();
if (!checkers)
return true; 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;
} }

View File

@ -43,6 +43,7 @@ public:
long GetFreshnessInterval(void) const; long GetFreshnessInterval(void) const;
Dictionary::Ptr GetDependencies(void) const; Dictionary::Ptr GetDependencies(void) const;
Dictionary::Ptr GetGroups(void) const; Dictionary::Ptr GetGroups(void) const;
Dictionary::Ptr GetCheckers(void) const;
void SetNextCheck(time_t nextCheck); void SetNextCheck(time_t nextCheck);
time_t GetNextCheck(void); time_t GetNextCheck(void);

View File

@ -47,6 +47,7 @@ void CompatComponent::Start(void)
m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this)); m_StatusTimer->OnTimerExpired.connect(boost::bind(&CompatComponent::StatusTimerHandler, this));
m_StatusTimer->Start(); m_StatusTimer->Start();
CIB::RequireInformation(CIB_Configuration);
CIB::RequireInformation(CIB_ProgramStatus); CIB::RequireInformation(CIB_ProgramStatus);
CIB::RequireInformation(CIB_ServiceStatus); CIB::RequireInformation(CIB_ServiceStatus);
} }