ICINGA service object output is not correct
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 616
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
Describe the bug
Good morning all,
I am currently trying to optimize our call script.
For this I use the objects from ICINGA
Object Types https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#service
state, last_state and last_hard_state
According to the documentation a number should be output here.
The current state (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN)
At least that's how I understand it. With "state/last_state" no integer but OK, WARNING, CRITICAL, UNKNOWN is output.
Now I wanted to work with the object "last_hard_state". Here I noticed that integers are output.
With a CRITICAL I receive accordingly a 2.
But the object last_hard_state always returns only CRITICAL. For a service that should immediately issue an alarm when it changes from OK to CRITICAL (1/1), the object last_hard_state contains the value CRITICAL although the service was previously in the hard state OK.
Expected behavior
If a service is in HARD state OK the object last_hard_state should output OK when the service changes to a new HARD state.
Only when the service comes to a new hard state, the object last_hard_state in the previous hard state may change.
The objects state, last_state and last_hard_state should all have the same output. Either integer or alphanumeric
Your Environment
Icinga DB Web version (System - About): 1.0.2
Icinga Web 2 version (System - About):2.11.4
Web browser: Chrome 110.0.5481.100
Icinga 2 version (icinga2 --version): r2.13.7-1
Icinga DB version (icingadb --version): v1.1.0
PHP version used (php --version): 7.4
Server operating system and version: Debian 10
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.
Research direction
Start by reviewing the linked pull request #9737 and the Icinga service object documentation referenced in the issue. Compare the outputs and state-transition behavior of state, last_state, and last_hard_state for OK and CRITICAL changes; done means their behavior matches the agreed expected semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100