Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
1.99k stars 573 forks source link

IDO: Wrong "last_hard_state" values in IDO table "statehistory" #5441

Closed networking-guy closed 4 years ago

networking-guy commented 7 years ago

I supspect that there is an existing bug with the field "last_hard_state" for the table "statehistory" in the IDO. If a host changes its hard state, the field "last_hard_state" equals the field "state". Possible duplicate to "https://monitoring-portal.org/index.php?thread/40698-state-and-last-state/" from an other user reporting:

Edit - Correction: host.last_hard_state also shows current state at notification time.

Expected Behavior

I would expect, that "last_hard_state" reflects the last hard state: status: up - state: 0 / last_hard_state:0 status; down(hard) - state:1 / last_hard_state:0 status: up - state: 0 / last_hard_state:1

Current Behavior

The current behavior: status: up - state: 0 / last_hard_state:0 status; down(hard) - state:1 / last_hard_state:1 status: up - state: 0 / last_hard_state:0

Steps to Reproduce (for bugs)

  1. create host
  2. submit multiple passive results for host / triggering hard states
  3. check ido e.g. following SQL query: SELECT state_time, name1, state, last_hard_state, icinga_statehistory.* FROM icinga_statehistory, icinga_objects WHERE state_type = 1 AND icinga_statehistory.object_id = icinga_objects.object_id AND icinga_objects.objecttype_id = 1

Context

We trying to create reports which should reflect up/down (only hard state) informations about host and services.

Your Environment

Crunsher commented 7 years ago

That sounds really familiar, but I couldn't find a ticket right away either 😕

mj84 commented 7 years ago

I stumbled across this issue as well a few times, it seems that this has been carried along since icinga1: https://github.com/Icinga/icinga-core/issues/1342

dnsmichi commented 4 years ago

Will be taken into account for IcingaDB, but not the IDO schema.