mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Bugfixes for the soft/hard state calculation.
This commit is contained in:
parent
22f301073e
commit
0f5ea5b53b
@ -102,7 +102,7 @@ void Service::SetCurrentCheckAttempt(long attempt)
|
|||||||
|
|
||||||
long Service::GetCurrentCheckAttempt(void) const
|
long Service::GetCurrentCheckAttempt(void) const
|
||||||
{
|
{
|
||||||
long value = 0;
|
long value = 1;
|
||||||
GetConfigObject()->GetTag("check_attempt", &value);
|
GetConfigObject()->GetTag("check_attempt", &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -135,24 +135,22 @@ void Service::ApplyCheckResult(const CheckResult& cr)
|
|||||||
{
|
{
|
||||||
long attempt = GetCurrentCheckAttempt();
|
long attempt = GetCurrentCheckAttempt();
|
||||||
|
|
||||||
if (GetState() == StateOK && cr.GetState() == StateOK) {
|
if (cr.GetState() == StateOK) {
|
||||||
SetStateType(StateTypeHard);
|
if (GetState() == StateOK)
|
||||||
SetCurrentCheckAttempt(0);
|
SetStateType(StateTypeHard);
|
||||||
} else if (GetState() == StateOK && cr.GetState() != StateOK) {
|
|
||||||
attempt++;
|
|
||||||
|
|
||||||
|
attempt = 1;
|
||||||
|
} else {
|
||||||
if (attempt >= GetMaxCheckAttempts()) {
|
if (attempt >= GetMaxCheckAttempts()) {
|
||||||
SetStateType(StateTypeHard);
|
SetStateType(StateTypeHard);
|
||||||
attempt = 0;
|
attempt = 1;
|
||||||
} else {
|
} else if (GetStateType() == StateTypeSoft || GetState() == StateOK) {
|
||||||
SetStateType(StateTypeSoft);
|
SetStateType(StateTypeSoft);
|
||||||
|
attempt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentCheckAttempt(attempt);
|
|
||||||
} else if (GetState() != StateOK && cr.GetState() == StateOK) {
|
|
||||||
SetState(StateOK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetCurrentCheckAttempt(attempt);
|
||||||
SetState(cr.GetState());
|
SetState(cr.GetState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user