Page 1 of 1

Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 5:11 am
by TadejT
Hi,

I have problem gettin info about previous state duration.
For example, when i gate alert about host is down I would like to know how long it was up and vice-versa.

I tried with $LASTHOSTDOWN$ but it returned 0 value.

Can someone help me?

Best regards

Tadej

Re: Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 7:55 am
by scottwilkerson
Are you using $LASTHOSTDOWN$ from a service check? On service checks you would want to use $LASTSERVICECRITICAL$

If you want to know the last time it was UP you would use:
$LASTHOSTUP$

and for a service
$LASTSERVICEOK$

Re: Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 8:59 am
by TadejT
I use $LASTHOSTUP$ and $LASTHOSTDOWN$.

But for example on recovery, when host is UP, I always get similar time. It is somehow logical because last time down it was just before reocvery.

I would just like to know how long was host DOWN when I get RECOVERY notification.

Thanks

Re: Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 9:16 am
by scottwilkerson
Hmm, I would think you would want something like

Code: Select all
$LASTHOSTDOWN$ - $LASTHOSTCHECK$

Re: Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 9:51 am
by TadejT
Hm, I will try but wouldn't this return time between last check and last time down?

I would need time between last host down and "first".

Re: Downtime and uptime duration

PostPosted: Thu Nov 07, 2019 9:59 am
by scottwilkerson
$LASTHOSTCHECK$ will be the last time the host was checked, which should be the check that produced the recovery.

so
$LASTHOSTDOWN$ - $LASTHOSTCHECK$ = seconds host was down

Re: Downtime and uptime duration

PostPosted: Fri Nov 08, 2019 2:08 am
by TadejT
I tried but diffrence is about one minutor or less, what is logical because $LASTHOSTDOWN$ is just before recover and not time when device went to DOWN state.

Re: Downtime and uptime duration

PostPosted: Fri Nov 08, 2019 9:46 am
by scottwilkerson
I see the problem, but unfortunately there isn't a macro that defines what you are looking for.

Re: Downtime and uptime duration

PostPosted: Sun Nov 17, 2019 12:47 pm
by adamto99
TadejT wrote:I tried but diffrence is about one minutor or less, what is logical because $LASTHOSTDOWN$ is just before recover and not time when device went to DOWN state.

I have problem gettin info about previous state duration.

Re: Downtime and uptime duration

PostPosted: Mon Nov 18, 2019 10:23 am
by scottwilkerson
As mentioned before, there is no macro for getting duration of a previous state.