From 91aad7c997be49361e0c95dfce92d85a9f4e69cc Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 12 Sep 2013 15:20:01 +0200 Subject: [PATCH] checker: Make sure non-authoritative cluster instances don't reschedule checks. --- components/checker/checkercomponent.cpp | 6 ++++-- components/checker/checkercomponent.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index b31f53ce1..84770f6a2 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -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::type CheckTimeView; CheckTimeView& idx = boost::get<1>(m_IdleServices); diff --git a/components/checker/checkercomponent.h b/components/checker/checkercomponent.h index c16f18508..29e5f9e99 100644 --- a/components/checker/checkercomponent.h +++ b/components/checker/checkercomponent.h @@ -23,6 +23,7 @@ #include "icinga/service.h" #include "base/dynamicobject.h" #include "base/timer.h" +#include "base/utility.h" #include #include #include @@ -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) {