Reschedule services before running checks.

Fixes #5754
This commit is contained in:
Gunnar Beutner 2014-03-13 14:09:52 +01:00
parent 51f30f28dc
commit 74209bde40
3 changed files with 5 additions and 7 deletions

View File

@ -35,7 +35,7 @@ using namespace icinga;
REGISTER_SCRIPTFUNCTION(ClusterCheck, &ClusterCheckTask::ScriptFunc); REGISTER_SCRIPTFUNCTION(ClusterCheck, &ClusterCheckTask::ScriptFunc);
CheckResult::Ptr ClusterCheckTask::ScriptFunc(const Service::Ptr&) void ClusterCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult::Ptr& cr)
{ {
/* fetch specific cluster status */ /* fetch specific cluster status */
std::pair<Dictionary::Ptr, Dictionary::Ptr> stats; std::pair<Dictionary::Ptr, Dictionary::Ptr> stats;
@ -63,13 +63,11 @@ CheckResult::Ptr ClusterCheckTask::ScriptFunc(const Service::Ptr&)
" Endpoints (" + not_connected_endpoints + ") not connected."; " Endpoints (" + not_connected_endpoints + ") not connected.";
} }
CheckResult::Ptr cr = make_shared<CheckResult>();
cr->SetOutput(output); cr->SetOutput(output);
cr->SetPerformanceData(perfdata); cr->SetPerformanceData(perfdata);
cr->SetState(state); cr->SetState(state);
cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName()); cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
service->ProcessCheckResult(cr);
return cr;
} }
String ClusterCheckTask::FormatArray(const Array::Ptr& arr) String ClusterCheckTask::FormatArray(const Array::Ptr& arr)

View File

@ -33,7 +33,7 @@ namespace icinga
class ClusterCheckTask class ClusterCheckTask
{ {
public: public:
static CheckResult::Ptr ScriptFunc(const Service::Ptr& service); static void ScriptFunc(const Service::Ptr& service, const CheckResult::Ptr& cr);
private: private:
ClusterCheckTask(void); ClusterCheckTask(void);

View File

@ -489,6 +489,8 @@ void Service::ExecuteCheck(void)
ASSERT(!OwnsLock()); ASSERT(!OwnsLock());
UpdateNextCheck();
bool reachable = IsReachable(); bool reachable = IsReachable();
{ {
@ -505,8 +507,6 @@ void Service::ExecuteCheck(void)
SetLastReachable(reachable); SetLastReachable(reachable);
} }
UpdateNextCheck();
/* keep track of scheduling info in case the check type doesn't provide its own information */ /* keep track of scheduling info in case the check type doesn't provide its own information */
double scheduled_start = GetNextCheck(); double scheduled_start = GetNextCheck();
double before_check = Utility::GetTime(); double before_check = Utility::GetTime();