Skip to content

Commit

Permalink
initialize hosts last_state_change and last_hard_state_change
Browse files Browse the repository at this point in the history
Currently the hosts last_state_change and last_hard_state_change will only be initialized
if the state changes or in check_service.c when the first service result arives.
I see no reason why this shouldn't be done for host results as well.

Signed-off-by: Sven Nierlein <[email protected]>
  • Loading branch information
sni committed Feb 14, 2024
1 parent f852cea commit 10af9ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/naemon/checks_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,12 @@ static int handle_host_state(host *hst, int *alert_recorded)
}
}

/* initialize the last host state change times if necessary */
if (hst->last_state_change == (time_t)0)
hst->last_state_change = hst->last_check;
if (hst->last_hard_state_change == (time_t)0)
hst->last_hard_state_change = hst->last_check;

return OK;
}

Expand Down

0 comments on commit 10af9ff

Please sign in to comment.