$LASTHOSTUP$ macro

Marc Powell marc at ena.com
Mon Aug 18 23:35:42 CEST 2008


On Aug 18, 2008, at 4:01 PM, Sean McAfee wrote:

> James wrote:
>> I am using the $LASTHOSTUP$ macro but it displays a timestamp in  
>> time_t
>> format.
>> I need to convert it to seconds.
>>
>> Time since last UP: 1218979837

That is in seconds. Seconds since Jan 1, 1970.  :)

> If you're set on using it, you're stuck using a wrapper script (or  
> very
> creative command line-fu) to do the conversion.  Otherwise, I'd look
>

(...deja-vu...)
Creative command-line fu --

notification command {
echo " Some stuff about the host being down or something\n Duration of  
downtime was $$((`/bin/date +%s` - $LASTHOSTUP$)) seconds, starting  
around `/bin/date -d '1970-01-01 UTC $LASTHOSTUP$ sec'`" | mail -s ...

Note there's a rumor in another thread that this macro might get  
updated before the notification is sent. YMMV.

--
Marc 

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