Checkable::GetSeverity(): consider reachability#10399
Merged
julianbrost merged 9 commits intomasterfrom Apr 2, 2025
Merged
Conversation
No change in functionality, just making the code a bit nicer and more compact.
No change in functionality, just making the code a bit more compact.
No change in functionality. The first two branches actually set the final return value for the method, so they can just return directly, removing the need to have the rest of the function inside an else block.
No change in functionality. The ObjectLock destructor will implicitly release the locks when returning from the function.
No change in functionality, just makes the code a bit nicer.
No change in functionality. The first two branches actually set the final return value for the method, so they can just return directly, removing the need to have the rest of the function inside an else block.
No change in functionality. The ObjectLock destructor will implicitly release the locks when returning from the function.
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).
yhabteab
approved these changes
Apr 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR can be split in two general parts: All but the last commits are general cleanup of the code (nothing spectacular, just braces for ifs, early return instead of nesting code in an else block, and similar) in
Host::GetSeverity()andService::GetSeverity()without any change in functionality, these are split into individual commits so that the individual changes are easier to follow. Finally, the last commit implements the functional change of this PR.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:
IsReachable().Tests
The following config snippet generates host and service objects for all the combinations of the different state attributes, i.e. hosts like
github-10399-down-indowntime-acknowledged-unreachablewhere the parts of the name explain the state. For acknowledgements and downtime, API requests are listed below to bring the objects into the desired state, the rest of the state is automatically created by the config.Icinga 2 config
Icinga 2 API requests for adding acknowledgements and downtimes
Current master (0613381)
This PR (31a224c)
Ordering still looks reasonable overall. The notable change is that in the service list, you can see how all completely unhandled services (i.e. problem and not faded out with some pictogram) are moved to the top of the list.
fixes #10340