]> granicus.if.org Git - icinga2/commitdiff
Make the delegation interval configurable.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 13 Feb 2013 08:55:39 +0000 (09:55 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 13 Feb 2013 08:59:38 +0000 (09:59 +0100)
components/delegation/delegationcomponent.cpp
components/delegation/delegationcomponent.h
itl/standalone.conf

index 5744b2dc730bdd78c53771d96c0641deeff1f3ab..0ec753ed76554fc770837eecec9610ce8d0e1bc2 100644 (file)
@@ -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"));
index 4241a7d26de896f704973ba12f1b802a33ccdd02..b47751b2f61e7f511e35e851dbaadf8805e46f48 100644 (file)
@@ -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;
 };
 
 }
index 53f88f1ebff6d2567bdce433cf4ef9a2be2fef23..023c7b10f4ff775a499027f92b7ca07b42bc6bcf 100644 (file)
@@ -18,5 +18,9 @@
  ******************************************************************************/
  
 local object Component "checker" {}
-local object Component "delegation" {}
+
+local object Component "delegation" {
+       delegation_interval = 120
+}
+
 local object Component "notification" {}