LASTHOSTUP

James bjlockie at lockie.ca
Wed Aug 20 17:07:46 CEST 2008


On Wed, August 20, 2008 10:15 am, James wrote:
>

> I am trying to print the time it was in a down state.
> I tried the $LASTHOSTDOWN$ macro but it is in time_t format.
>
>
> I tried $HOSTDURATIONSEC$ but the documentation says it prints the number
>  of seconds a host has been in it's current state (0 seconds when a host
> comes up). I was to print how long it was down.
>
>
> I'm also going to want to do this for services.
>
>
> I will try the command line fu that was suggested.
> I wanted to do it with macros. :-(

Mark Powell suggest this:
Duration of downtime was $((`/bin/date +%s` - $LASTHOSTUP$)) seconds

I am using Solaris and there is no %s so I tried %S.

I only want to include that on a HOSTUP notification so can I have some
sort of if-else?


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list