[icinga-checkins] icinga.org: icinga2/master: Make the delegation interval configurable.

git at icinga.org git at icinga.org
Wed Feb 13 09:59:50 CET 2013


Module: icinga2
Branch: master
Commit: b17cafd0cf378cbe0dc305ad5648332c5344d0a7
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=b17cafd0cf378cbe0dc305ad5648332c5344d0a7

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Feb 13 09:55:39 2013 +0100

Make the delegation interval configurable.

---

 components/delegation/delegationcomponent.cpp |   13 ++++++++++++-
 components/delegation/delegationcomponent.h   |    2 ++
 itl/standalone.conf                           |    6 +++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp
index 5744b2d..0ec753e 100644
--- a/components/delegation/delegationcomponent.cpp
+++ b/components/delegation/delegationcomponent.cpp
@@ -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"));
diff --git a/components/delegation/delegationcomponent.h b/components/delegation/delegationcomponent.h
index 4241a7d..b47751b 100644
--- a/components/delegation/delegationcomponent.h
+++ b/components/delegation/delegationcomponent.h
@@ -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;
 };
 
 }
diff --git a/itl/standalone.conf b/itl/standalone.conf
index 53f88f1..023c7b1 100644
--- a/itl/standalone.conf
+++ b/itl/standalone.conf
@@ -18,5 +18,9 @@
  ******************************************************************************/
  
 local object Component "checker" {}
-local object Component "delegation" {}
+
+local object Component "delegation" {
+	delegation_interval = 120
+}
+
 local object Component "notification" {}





More information about the icinga-checkins mailing list