Down time in UP messages?

Jedrzej Jajor jedrzej at man.poznan.pl
Sat Jan 13 20:59:01 CET 2007


Hi Hugo,
> Hi,
>
> Did someone manage to get the down time in UP messages for hosts and/or 
> services?
>
> I have been tampering a little bit with it but could not get any 
> reliable/workable results. But I may havebeen missing out something rather 
> obvious.
>
> I tried a thing like:
>
> #       command_line    /usr/bin/printf "%b" "***** Nagios 
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: 
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: 
> $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional 
> Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - 
> $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
>          command_line    /usr/bin/printf "%b" "***** Nagios 
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: 
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: 
> $SERVICESTATE$\nDuration: $SERVICEDURATION$\n\nDate/Time: 
> $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** 
> $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" 
> $CONTACTEMAIL$
>
> But it tells me the duration of the uptime. (Which is usually around 1 
> second.)
>   

I'd try to play with $LASTHOSTUP$ and $LASTSERVICEOK$ macros.
Substracting these values from current date in $TIMET$ should give
approximate host/service downtime in seconds. I was planning on trying
that soon in my own Nagios, but let me know if you find out whether it
works.

Jedrzej.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3325 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070113/967be8f9/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
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