[icinga-checkins] icinga.org: icinga2/master: Log a warning if there are more than 2 zone endpoint members
git at icinga.org
git at icinga.org
Tue Jul 26 08:11:46 CEST 2016
Module: icinga2
Branch: master
Commit: 55a3dc22bf6d231b40244028ef59e03265042f75
URL: https://git.icinga.org/?p=icinga2.git;a=commit;h=55a3dc22bf6d231b40244028ef59e03265042f75
Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date: Tue Jul 26 08:10:47 2016 +0200
Log a warning if there are more than 2 zone endpoint members
fixes #12222
---
lib/remote/zone.cpp | 12 ++++++++++++
lib/remote/zone.hpp | 3 +++
2 files changed, 15 insertions(+)
diff --git a/lib/remote/zone.cpp b/lib/remote/zone.cpp
index d856b7d..ded60f6 100644
--- a/lib/remote/zone.cpp
+++ b/lib/remote/zone.cpp
@@ -21,6 +21,7 @@
#include "remote/zone.tcpp"
#include "remote/jsonrpcconnection.hpp"
#include "base/objectlock.hpp"
+#include "base/logger.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
@@ -121,3 +122,14 @@ Zone::Ptr Zone::GetLocalZone(void)
return local->GetZone();
}
+void Zone::ValidateEndpointsRaw(const Array::Ptr& value, const ValidationUtils& utils)
+{
+ ObjectImpl<Zone>::ValidateEndpointsRaw(value, utils);
+
+ if (value && value->GetLength() > 2) {
+ Log(LogWarning, "Zone")
+ << "The Zone object '" << GetName() << "' has more than two endpoints."
+ << " Due to a known issue this type of configuration is strongly"
+ << " discouraged and may cause Icinga to use excessive amounts of CPU time.";
+ }
+}
diff --git a/lib/remote/zone.hpp b/lib/remote/zone.hpp
index 4d00a51..c633d49 100644
--- a/lib/remote/zone.hpp
+++ b/lib/remote/zone.hpp
@@ -48,6 +48,9 @@ public:
static Zone::Ptr GetLocalZone(void);
+protected:
+ virtual void ValidateEndpointsRaw(const Array::Ptr& value, const ValidationUtils& utils) override;
+
private:
Zone::Ptr m_Parent;
std::vector<Zone::Ptr> m_AllParents;
More information about the icinga-checkins
mailing list