Downtime and uptime duration

Discuss new project and feature ideas here.
See labs.nagios.com for new projects under development.

Downtime and uptime duration

Postby TadejT » Thu Nov 07, 2019 5:11 am

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
TadejT
 
Posts: 4
Joined: Thu Nov 07, 2019 4:52 am

Re: Downtime and uptime duration

Postby scottwilkerson » Thu Nov 07, 2019 7:55 am

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$
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 16617
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Downtime and uptime duration

Postby TadejT » Thu Nov 07, 2019 8:59 am

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
TadejT
 
Posts: 4
Joined: Thu Nov 07, 2019 4:52 am

Re: Downtime and uptime duration

Postby scottwilkerson » Thu Nov 07, 2019 9:16 am

Hmm, I would think you would want something like

Code: Select all
$LASTHOSTDOWN$ - $LASTHOSTCHECK$
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 16617
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Downtime and uptime duration

Postby TadejT » Thu Nov 07, 2019 9:51 am

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".
TadejT
 
Posts: 4
Joined: Thu Nov 07, 2019 4:52 am

Re: Downtime and uptime duration

Postby scottwilkerson » Thu Nov 07, 2019 9:59 am

$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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 16617
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Downtime and uptime duration

Postby TadejT » Fri Nov 08, 2019 2:08 am

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.
TadejT
 
Posts: 4
Joined: Thu Nov 07, 2019 4:52 am

Re: Downtime and uptime duration

Postby scottwilkerson » Fri Nov 08, 2019 9:46 am

I see the problem, but unfortunately there isn't a macro that defines what you are looking for.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 16617
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Ideas

Who is online

Users browsing this forum: No registered users and 1 guest