LASTHOSTUP

Thomas Guyot-Sionnest dermoth at aei.ca
Thu Aug 21 00:43:39 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20/08/08 11:07 AM, James wrote:
> 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.

This will give you the current second (0-59) which won't work. Try this
instead:

$((`perl -e "print time"` - $LASTHOSTUP$))

You may need the full path to perl though...

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIrJ4b6dZ+Kt5BchYRAskCAJoCO3cTiCtlkF8d5PJbaj1CznQCqACgx0lb
gDXv91jKmTXUYIesQw1rky0=
=hX50
-----END PGP SIGNATURE-----

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