]> granicus.if.org Git - icinga2/commitdiff
Log a warning if there are more than 2 zone endpoint members
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 26 Jul 2016 06:10:47 +0000 (08:10 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 26 Jul 2016 06:10:47 +0000 (08:10 +0200)
fixes #12222

lib/remote/zone.cpp
lib/remote/zone.hpp

index d856b7d55bec4efd751757aea2bb8e8e24c0488c..ded60f62122b4b2921b554e4a363be55cfb2b25c 100644 (file)
@@ -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.";
+       }
+}
index 4d00a514a76a06d4e9cc3dd2cb7b37395626636f..c633d496792c6436c188992d33b84f5f009ade63 100644 (file)
@@ -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;