4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
cg28oh
Posts: 31
Joined: Mon Aug 18, 2014 9:38 am

4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Post 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?
User avatar
swolf
Developer
Posts: 302
Joined: Tue Jun 06, 2017 9:48 am

Re: 4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
Smat1981
Posts: 1
Joined: Sun Aug 27, 2023 11:40 pm

Re: 4.4.6/4.4.13 $LASTHOSTSTATECHANGE$ macro

Post 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
Post Reply