Downtime and uptime duration
Downtime and uptime duration
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
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Downtime and uptime duration
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$
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
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
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
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Downtime and uptime duration
Hmm, I would think you would want something like
Code: Select all
$LASTHOSTDOWN$ - $LASTHOSTCHECK$
Re: Downtime and uptime duration
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".
I would need time between last host down and "first".
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Downtime and uptime duration
$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
so
$LASTHOSTDOWN$ - $LASTHOSTCHECK$ = seconds host was down
Re: Downtime and uptime duration
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.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Downtime and uptime duration
I see the problem, but unfortunately there isn't a macro that defines what you are looking for.
Re: Downtime and uptime duration
I have problem gettin info about previous state duration.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.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Downtime and uptime duration
As mentioned before, there is no macro for getting duration of a previous state.