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.
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------- 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
_______________________________________________ Nagios-users mailing list [email protected] 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
