]> granicus.if.org Git - icinga2/commitdiff
checker: Make sure non-authoritative cluster instances don't reschedule checks.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 12 Sep 2013 13:20:01 +0000 (15:20 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 12 Sep 2013 13:20:01 +0000 (15:20 +0200)
components/checker/checkercomponent.cpp
components/checker/checkercomponent.h

index b31f53ce14a77fd0a830b8032d9e47df7b2c315f..84770f6a20612d61f6b9949c58df103f670211e3 100644 (file)
@@ -105,8 +105,9 @@ void CheckerComponent::CheckThreadProc(void)
 
                bool forced = service->GetForceNextCheck();
                bool check = true;
+               bool authoritative = service->HasAuthority("checker");
 
-               if (!service->HasAuthority("checker")) {
+               if (!authoritative) {
                        Log(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': not authoritative");
                        check = false;
                }
@@ -127,7 +128,8 @@ void CheckerComponent::CheckThreadProc(void)
 
                /* reschedule the service if checks are disabled */
                if (!check) {
-                       service->UpdateNextCheck();
+                       if (authoritative)
+                               service->UpdateNextCheck();
 
                        typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
                        CheckTimeView& idx = boost::get<1>(m_IdleServices);
index c16f185086744061f3725ba8ff90d2c89bf760cc..29e5f9e9971760e65b11af5c81d085194e99f300 100644 (file)
@@ -23,6 +23,7 @@
 #include "icinga/service.h"
 #include "base/dynamicobject.h"
 #include "base/timer.h"
+#include "base/utility.h"
 #include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
@@ -45,6 +46,9 @@ struct ServiceNextCheckExtractor
         */
        double operator()(const Service::Ptr& service)
        {
+               if (!service->HasAuthority("checker"))
+                       return Utility::GetTime() + 60;
+
                double next = service->GetNextCheck();
 
                while (next == 0) {