mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
parent
1f570ea9f7
commit
f278181b8b
@ -146,7 +146,7 @@ void Service::UpdateNextCheck(void)
|
|||||||
double adj = 0;
|
double adj = 0;
|
||||||
|
|
||||||
if (interval > 1)
|
if (interval > 1)
|
||||||
adj = fmod(now * 1000 + GetSchedulingOffset(), interval * 1000) / 1000.0;
|
adj = fmod(now * 100 + GetSchedulingOffset(), interval * 100) / 100.0;
|
||||||
|
|
||||||
SetNextCheck(now - adj + interval);
|
SetNextCheck(now - adj + interval);
|
||||||
}
|
}
|
||||||
@ -438,7 +438,6 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||||||
ServiceState old_state = GetState();
|
ServiceState old_state = GetState();
|
||||||
StateType old_stateType = GetStateType();
|
StateType old_stateType = GetStateType();
|
||||||
long old_attempt = GetCurrentCheckAttempt();
|
long old_attempt = GetCurrentCheckAttempt();
|
||||||
bool hardChange = false;
|
|
||||||
bool recovery;
|
bool recovery;
|
||||||
|
|
||||||
/* The BeginExecuteCheck function already sets the old state, but we need to do it again
|
/* The BeginExecuteCheck function already sets the old state, but we need to do it again
|
||||||
@ -450,14 +449,8 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||||||
long attempt;
|
long attempt;
|
||||||
|
|
||||||
if (cr->Get("state") == StateOK) {
|
if (cr->Get("state") == StateOK) {
|
||||||
if (old_state != StateOK && old_stateType == StateTypeHard)
|
|
||||||
SetStateType(StateTypeSoft); // HARD NON-OK -> SOFT OK
|
|
||||||
|
|
||||||
if (old_state == StateOK && old_stateType == StateTypeSoft)
|
if (old_state == StateOK && old_stateType == StateTypeSoft)
|
||||||
hardChange = true; // SOFT OK -> HARD OK
|
SetStateType(StateTypeHard); // SOFT OK -> HARD OK
|
||||||
|
|
||||||
if (old_state == StateOK || old_stateType == StateTypeSoft)
|
|
||||||
SetStateType(StateTypeHard); // SOFT OK -> HARD OK or SOFT NON-OK -> HARD OK
|
|
||||||
|
|
||||||
attempt = 1;
|
attempt = 1;
|
||||||
recovery = true;
|
recovery = true;
|
||||||
@ -465,7 +458,6 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||||||
if (old_attempt >= GetMaxCheckAttempts()) {
|
if (old_attempt >= GetMaxCheckAttempts()) {
|
||||||
SetStateType(StateTypeHard);
|
SetStateType(StateTypeHard);
|
||||||
attempt = 1;
|
attempt = 1;
|
||||||
hardChange = true;
|
|
||||||
} else if (GetStateType() == StateTypeSoft || GetState() == StateOK) {
|
} else if (GetStateType() == StateTypeSoft || GetState() == StateOK) {
|
||||||
SetStateType(StateTypeSoft);
|
SetStateType(StateTypeSoft);
|
||||||
attempt = old_attempt + 1;
|
attempt = old_attempt + 1;
|
||||||
@ -508,6 +500,8 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hardChange = (GetStateType() == StateTypeHard && old_stateType == StateTypeSoft);
|
||||||
|
|
||||||
if (hardChange)
|
if (hardChange)
|
||||||
SetLastHardStateChange(now);
|
SetLastHardStateChange(now);
|
||||||
|
|
||||||
@ -519,6 +513,9 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||||||
bool in_downtime = IsInDowntime();
|
bool in_downtime = IsInDowntime();
|
||||||
bool send_notification = hardChange && reachable && !in_downtime && !IsAcknowledged();
|
bool send_notification = hardChange && reachable && !in_downtime && !IsAcknowledged();
|
||||||
|
|
||||||
|
if (old_state == StateOK && old_stateType == StateTypeSoft)
|
||||||
|
send_notification = false; /* Don't send notifications for SOFT-OK -> HARD-OK. */
|
||||||
|
|
||||||
bool send_downtime_notification = m_LastInDowntime != in_downtime;
|
bool send_downtime_notification = m_LastInDowntime != in_downtime;
|
||||||
m_LastInDowntime = in_downtime;
|
m_LastInDowntime = in_downtime;
|
||||||
Touch("last_in_downtime");
|
Touch("last_in_downtime");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user