Icinga / icinga-core

Icinga 1.x, the old core (EOL 31.12.2018)
GNU General Public License v2.0
45 stars 27 forks source link

host in 'down' state is showing wrong duration (after passing from soft to hard) #1597

Open zibfr opened 7 years ago

zibfr commented 7 years ago

Hi guys,

bug reproduced on

in status.dat for a DOWN host, both value are the same :

not for a CRITICAL service :

seems to me last_state_change resets between SOFT and HARD state for a host, not a service bug ? possible to correct/modify this behavior ?

more details here: https://monitoring-portal.org/index.php?thread/35228-host-in-down-state-is-showing-wrong-duration/

thanks in advance for any help regarding this matter. Regards, Zibfr

zibfr commented 7 years ago

if i have one host (with a service ping), i also have 15min difference (I use same check command for both host status and PING service status) my delay between SOFT and HARD is 15min btw image

zibfr commented 7 years ago

if you need any more infos, feel free (y)

zibfr commented 7 years ago

just to let you know wolfgang put a solution in https://monitoring-portal.org/index.php?thread/35228-host-in-down-state-is-showing-wrong-duration/

i will give it a try with next upgrade and let you know.

Regards, Zibfr

zibfr commented 7 years ago

Hi there,

the following patch (from @wolfgang) works perfectly:

in base/check.c Change

    /* update last state change times */
    hst->last_state_change = current_time;
    if (hst->state_type == HARD_STATE)
        hst->last_hard_state_change = current_time;

to

    /* update last state change times */
    if (hst->last_state != hst->current_state)
        hst->last_state_change = hst->last_check;
    if (hst->state_type == HARD_STATE)
        hst->last_hard_state_change = hst->last_check;

I tested this workaround on my test server.

In order to correct this on both our production icinga servers (as my boss only accepts official source code with no correction of any kind), could you please correct this bug ideally for v1.9.2 and v1.12.2 (and/or at least latest 1.13.x version) plz ?

Regards Zibfr

dnsmichi commented 6 years ago

I'd merge a PR of yours, and you can backport the patch into the old EOL releases then. Icinga 1.x doesn't receive updates anymore, just security related and minor things for current 1.14.