Page 1 of 1

4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Posted: Wed Aug 02, 2023 1:53 pm
by cg28oh
Hi everybody!

Recently upgraded from, 4.4.6 to 4.4.13 hand have noticed that the macro $LASTHOSTSTATECHANGE$ timestamp has changed. I believe the change is due to a fix #891, Fix mismatched host/service behavior when changing from SOFT to HARD state. In 4.4.6 the $LASTHOSTSTATECHANGE$ reported the timestamp of the change from Normal to DOWN of the first SOFT event. In 4.4.13, it is the timestamp of the change from SOFT to HARD. In my environment, it creates a 10–12-minute time difference between the 2 state changes. We track outages based on the first timestamp from Normal to DOWN. I've tried some of the other macros and they all report the timestamp from SOFT to HARD. Is there another way to get the timestamp for Normal to down?

Re: 4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Posted: Mon Aug 14, 2023 11:03 am
by swolf
Hi @cg28oh, thanks for reaching out.

The short answer to your question is probably "not right now". You can check whether $LASTSERVICEOK$ and $LASTHOSTOK$ match what you want, but I wouldn't be surprised if they were affected by the fix to #891 as well. I didn't really consider your use-case when I went to make that change - I just noticed that hosts and services had different behavior from each other, and both had flipped since some much earlier release.

If you write an issue on the Nagios Core Github page, I'd be open to making sure there's a macro that does what you need in the next feature release (which should be coming in September or October).

Hopefully that helps, let me know what you think.

-Sebastian Wolf

Re: 4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Posted: Sun Aug 27, 2023 11:42 pm
by Smat1981
You can modify the Nagios configuration to capture and store the desired timestamp in a custom variable or performance data. This can be achieved by writing a custom plugin or utilizing event handlers to capture the desired timestamp and store it for later use.
Donkey Kong