mirror of https://github.com/Icinga/icinga2.git
Make the delegation interval configurable.
This commit is contained in:
parent
800750c415
commit
b17cafd0cf
|
@ -27,11 +27,22 @@ EXPORT_COMPONENT(delegation, DelegationComponent);
|
|||
void DelegationComponent::Start(void)
|
||||
{
|
||||
m_DelegationTimer = boost::make_shared<Timer>();
|
||||
m_DelegationTimer->SetInterval(30);
|
||||
// TODO: implement a handler for config changes for the delegation_interval variable
|
||||
m_DelegationTimer->SetInterval(GetDelegationInterval());
|
||||
m_DelegationTimer->Reschedule(Utility::GetTime() + 10);
|
||||
m_DelegationTimer->OnTimerExpired.connect(boost::bind(&DelegationComponent::DelegationTimerHandler, this));
|
||||
m_DelegationTimer->Start();
|
||||
}
|
||||
|
||||
double DelegationComponent::GetDelegationInterval(void) const
|
||||
{
|
||||
Value interval = GetConfig()->Get("delegation_interval");
|
||||
if (interval.IsEmpty())
|
||||
return 30;
|
||||
else
|
||||
return interval;
|
||||
}
|
||||
|
||||
bool DelegationComponent::IsEndpointChecker(const Endpoint::Ptr& endpoint)
|
||||
{
|
||||
return (endpoint->HasSubscription("checker"));
|
||||
|
|
|
@ -39,6 +39,8 @@ private:
|
|||
vector<Endpoint::Ptr> GetCheckerCandidates(const Service::Ptr& service) const;
|
||||
|
||||
static bool IsEndpointChecker(const Endpoint::Ptr& endpoint);
|
||||
|
||||
double GetDelegationInterval(void) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,5 +18,9 @@
|
|||
******************************************************************************/
|
||||
|
||||
local object Component "checker" {}
|
||||
local object Component "delegation" {}
|
||||
|
||||
local object Component "delegation" {
|
||||
delegation_interval = 120
|
||||
}
|
||||
|
||||
local object Component "notification" {}
|
||||
|
|
Loading…
Reference in New Issue