mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Use UpdateNextCheck() for determining the retry_interval in ProcessCheckResult()
This patch also moves the next check updates for passive check results into ProcessCheckResult(). That way the next check status updates for DB IDO work in a sane way again. refs #11336
This commit is contained in:
parent
3bd6848763
commit
d682f56c38
@ -110,11 +110,6 @@ Dictionary::Ptr ApiActions::ProcessCheckResult(const ConfigObject::Ptr& object,
|
|||||||
|
|
||||||
checkable->ProcessCheckResult(cr);
|
checkable->ProcessCheckResult(cr);
|
||||||
|
|
||||||
/* Reschedule the next check. The side effect of this is that for as long
|
|
||||||
* as we receive passive results for a service we won't execute any
|
|
||||||
* active checks. */
|
|
||||||
checkable->SetNextCheck(Utility::GetTime() + checkable->GetCheckInterval());
|
|
||||||
|
|
||||||
return ApiActions::CreateResult(200, "Successfully processed check result for object '" + checkable->GetName() + "'.");
|
return ApiActions::CreateResult(200, "Successfully processed check result for object '" + checkable->GetName() + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ long Checkable::GetSchedulingOffset(void)
|
|||||||
return m_SchedulingOffset;
|
return m_SchedulingOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::UpdateNextCheck(void)
|
void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
double interval;
|
double interval;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ void Checkable::UpdateNextCheck(void)
|
|||||||
if (interval > 1)
|
if (interval > 1)
|
||||||
adj = fmod(now * 100 + GetSchedulingOffset(), interval * 100) / 100.0;
|
adj = fmod(now * 100 + GetSchedulingOffset(), interval * 100) / 100.0;
|
||||||
|
|
||||||
SetNextCheck(now - adj + interval);
|
SetNextCheck(now - adj + interval, false, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Checkable::HasBeenChecked(void) const
|
bool Checkable::HasBeenChecked(void) const
|
||||||
@ -198,13 +198,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
} else if (IsStateOK(old_state)) {
|
} else if (IsStateOK(old_state)) {
|
||||||
SetStateType(StateTypeSoft);
|
SetStateType(StateTypeSoft);
|
||||||
attempt = 1; // OK -> NOT-OK transition, reset the counter
|
attempt = 1; // OK -> NOT-OK transition, reset the counter
|
||||||
|
|
||||||
/* If there was a OK -> NOT-OK state change for actively scheduled checks,
|
|
||||||
* update the next check time using the retry_interval.
|
|
||||||
* Important: Add the cluster message origin.
|
|
||||||
*/
|
|
||||||
if (cr->GetActive())
|
|
||||||
SetNextCheck(Utility::GetTime() + GetRetryInterval(), false, origin);
|
|
||||||
} else {
|
} else {
|
||||||
attempt = old_attempt;
|
attempt = old_attempt;
|
||||||
}
|
}
|
||||||
@ -329,6 +322,18 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||||||
|
|
||||||
is_flapping = IsFlapping();
|
is_flapping = IsFlapping();
|
||||||
|
|
||||||
|
if (cr->GetActive()) {
|
||||||
|
/* If there was a OK -> NOT-OK state change for actively scheduled checks,
|
||||||
|
* update the next check time using the retry_interval.
|
||||||
|
* Important: Add the cluster message origin. */
|
||||||
|
UpdateNextCheck(origin);
|
||||||
|
} else {
|
||||||
|
/* Reschedule the next check for passive check results. The side effect of
|
||||||
|
* this is that for as long as we receive passive results for a service we
|
||||||
|
* won't execute any active checks. */
|
||||||
|
SetNextCheck(Utility::GetTime() + GetCheckInterval(), false, origin);
|
||||||
|
}
|
||||||
|
|
||||||
olock.Unlock();
|
olock.Unlock();
|
||||||
|
|
||||||
// Log(LogDebug, "Checkable")
|
// Log(LogDebug, "Checkable")
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
long GetSchedulingOffset(void);
|
long GetSchedulingOffset(void);
|
||||||
void SetSchedulingOffset(long offset);
|
void SetSchedulingOffset(long offset);
|
||||||
|
|
||||||
void UpdateNextCheck(void);
|
void UpdateNextCheck(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
|
||||||
|
|
||||||
bool HasBeenChecked(void) const;
|
bool HasBeenChecked(void) const;
|
||||||
virtual bool IsStateOK(ServiceState state) = 0;
|
virtual bool IsStateOK(ServiceState state) = 0;
|
||||||
|
@ -367,11 +367,6 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
|
|||||||
<< "Processing passive check result for host '" << arguments[0] << "'";
|
<< "Processing passive check result for host '" << arguments[0] << "'";
|
||||||
|
|
||||||
host->ProcessCheckResult(result);
|
host->ProcessCheckResult(result);
|
||||||
|
|
||||||
/* Reschedule the next check. The side effect of this is that for as long
|
|
||||||
* as we receive passive results for a service we won't execute any
|
|
||||||
* active checks. */
|
|
||||||
host->SetNextCheck(Utility::GetTime() + host->GetCheckInterval());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std::vector<String>& arguments)
|
void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std::vector<String>& arguments)
|
||||||
@ -404,11 +399,6 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
|
|||||||
<< "Processing passive check result for service '" << arguments[1] << "'";
|
<< "Processing passive check result for service '" << arguments[1] << "'";
|
||||||
|
|
||||||
service->ProcessCheckResult(result);
|
service->ProcessCheckResult(result);
|
||||||
|
|
||||||
/* Reschedule the next check. The side effect of this is that for as long
|
|
||||||
* as we receive passive results for a service we won't execute any
|
|
||||||
* active checks. */
|
|
||||||
service->SetNextCheck(Utility::GetTime() + service->GetCheckInterval());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<String>& arguments)
|
void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<String>& arguments)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user