mirror of https://github.com/Icinga/icinga2.git
checker: Make sure non-authoritative cluster instances don't reschedule checks.
This commit is contained in:
parent
b510545d4d
commit
91aad7c997
|
@ -105,8 +105,9 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
|
|
||||||
bool forced = service->GetForceNextCheck();
|
bool forced = service->GetForceNextCheck();
|
||||||
bool check = true;
|
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");
|
Log(LogDebug, "checker", "Skipping check for service '" + service->GetName() + "': not authoritative");
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +128,8 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
|
|
||||||
/* reschedule the service if checks are disabled */
|
/* reschedule the service if checks are disabled */
|
||||||
if (!check) {
|
if (!check) {
|
||||||
service->UpdateNextCheck();
|
if (authoritative)
|
||||||
|
service->UpdateNextCheck();
|
||||||
|
|
||||||
typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
|
typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
|
||||||
CheckTimeView& idx = boost::get<1>(m_IdleServices);
|
CheckTimeView& idx = boost::get<1>(m_IdleServices);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "icinga/service.h"
|
#include "icinga/service.h"
|
||||||
#include "base/dynamicobject.h"
|
#include "base/dynamicobject.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
#include "base/utility.h"
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/condition_variable.hpp>
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
@ -45,6 +46,9 @@ struct ServiceNextCheckExtractor
|
||||||
*/
|
*/
|
||||||
double operator()(const Service::Ptr& service)
|
double operator()(const Service::Ptr& service)
|
||||||
{
|
{
|
||||||
|
if (!service->HasAuthority("checker"))
|
||||||
|
return Utility::GetTime() + 60;
|
||||||
|
|
||||||
double next = service->GetNextCheck();
|
double next = service->GetNextCheck();
|
||||||
|
|
||||||
while (next == 0) {
|
while (next == 0) {
|
||||||
|
|
Loading…
Reference in New Issue