mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-21 12:44:58 +02:00
Fixed soft service recoveries.
This commit is contained in:
parent
0e7a3c67ec
commit
0d1cad864c
@ -287,11 +287,15 @@ void Service::ApplyCheckResult(const Dictionary::Ptr& cr)
|
|||||||
{
|
{
|
||||||
ServiceState old_state = GetState();
|
ServiceState old_state = GetState();
|
||||||
ServiceStateType old_stateType = GetStateType();
|
ServiceStateType old_stateType = GetStateType();
|
||||||
|
bool hardChange = false;
|
||||||
|
|
||||||
long attempt = GetCurrentCheckAttempt();
|
long attempt = GetCurrentCheckAttempt();
|
||||||
|
|
||||||
if (cr->Get("state") == StateOK) {
|
if (cr->Get("state") == StateOK) {
|
||||||
if (GetState() == StateOK)
|
if (old_state != StateOK && old_stateType == StateTypeHard)
|
||||||
|
hardChange = true; // hard recovery
|
||||||
|
|
||||||
|
if (old_state == StateOK)
|
||||||
SetStateType(StateTypeHard);
|
SetStateType(StateTypeHard);
|
||||||
|
|
||||||
attempt = 1;
|
attempt = 1;
|
||||||
@ -299,6 +303,7 @@ void Service::ApplyCheckResult(const Dictionary::Ptr& cr)
|
|||||||
if (attempt >= GetMaxCheckAttempts()) {
|
if (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++;
|
attempt++;
|
||||||
@ -341,7 +346,7 @@ void Service::ApplyCheckResult(const Dictionary::Ptr& cr)
|
|||||||
if (GetState() != StateOK)
|
if (GetState() != StateOK)
|
||||||
TriggerDowntimes();
|
TriggerDowntimes();
|
||||||
|
|
||||||
if (GetStateType() == StateTypeHard && (old_state != GetState() || old_stateType == StateTypeSoft)) {
|
if (hardChange) {
|
||||||
SetLastHardStateChange(now);
|
SetLastHardStateChange(now);
|
||||||
|
|
||||||
/* Make sure the notification component sees the updated
|
/* Make sure the notification component sees the updated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user