Icinga DB: inconsistent `state_type` value for volatile checks
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 616
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
Describe the bug
Icinga 2 allows to treat every state change as a hard state change with the additional volatile checkable option, howver, the state_type of the respective checkable doesn't reflect that. As it can be seen below, the StateChange event is always triggered for volatile checks even hardChange is still false:
https://github.com/Icinga/icinga2/blob/91eeb41ff1d65d3ac068eedf68a3cd7b5e4468ef/lib/icinga/checkable-check.cpp#L412-L413
Since that event includes the type of the state change as an extra argument, the Icinga DB histories are generated correctly based ont that.
https://github.com/Icinga/icinga2/blob/91eeb41ff1d65d3ac068eedf68a3cd7b5e4468ef/lib/icingadb/icingadb-objects.cpp#L1912-L1916
However, that very same handler also implicitly triggers a runtime state update for that very same state change here:
https://github.com/Icinga/icinga2/blob/91eeb41ff1d65d3ac068eedf68a3cd7b5e4468ef/lib/icingadb/icingadb-objects.cpp#L1885
Which looses the extra StateType argument, and thus it will just serialize the host state, and since the checkable's state_type was never updated to hard, the resulting JSON will contain state_type soft because it actually is a soft state change but due to the volatile flag, it was treated as a hard state change. This either needs to be fixed in ProcessCheckResult or Icinga DB should take the Volatile flag into account when serializing the state.
Your Environment
N/A
Additional context
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.