mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
Checkable::GetSeverity(): always take reachability into account
So far, Service::GetSeverity() only considered the state of its own host, i.e. the implicit service to its own host dependency, and treated it similar to acknowledgements and downtimes. In contrast, Host::GetSeverity() considered reachability and treated it like a state, i.e. for the severity calculation, the host was either up, down, or unreachable. This commit changes the following things: 1. Make the service severity also consider explicitly configured dependencies by using IsReachable(). 2. Prefer acknowledgements and downtimes over unreachability in the severity calculation so that if an already acknowledged or in-downtime services (i.e. already handled service) becomes unreachable, it shouln't become more severe. 3. To unify host and service severities a bit, hosts now use the same logic that treats reachability more like acknowledgements/downtimes instead of like a state (changing the other way around would the state from the check plugin would not affect the severity for unrachable services anymore).
This commit is contained in:
parent
1e05a166f1
commit
31a224c509
@ -180,18 +180,14 @@ int Host::GetSeverity() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int severity = 0;
|
||||
|
||||
if (IsReachable()) {
|
||||
severity = 64;
|
||||
} else {
|
||||
severity = 32;
|
||||
}
|
||||
int severity = 32; // DOWN
|
||||
|
||||
if (IsAcknowledged()) {
|
||||
severity += 512;
|
||||
} else if (IsInDowntime()) {
|
||||
severity += 256;
|
||||
} else if (!IsReachable()) {
|
||||
severity += 1024;
|
||||
} else {
|
||||
severity += 2048;
|
||||
}
|
||||
|
@ -133,14 +133,12 @@ int Service::GetSeverity() const
|
||||
severity = 256;
|
||||
}
|
||||
|
||||
Host::Ptr host = GetHost();
|
||||
ObjectLock hlock (host);
|
||||
if (host->GetState() != HostUp) {
|
||||
severity += 1024;
|
||||
} else if (IsAcknowledged()) {
|
||||
if (IsAcknowledged()) {
|
||||
severity += 512;
|
||||
} else if (IsInDowntime()) {
|
||||
severity += 256;
|
||||
} else if (!IsReachable()) {
|
||||
severity += 1024;
|
||||
} else {
|
||||
severity += 2048;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user