Add time host has been down to "HOST UP" emails
Edson Manners
emanners at ucs.fsu.edu
Tue Jan 23 19:52:52 CET 2007
I am trying to add a line to "HOST UP" emails that shows for how long
the host was down.
The following is the current entry I have in my commands.cfg file
#------BEGIN SNIPPET---------------------------------------------
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type:
$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n
`/usr/local/bin/nagios_downtime \`date +%s\` $LASTHOSTUP$`\n" | mailx -s
"Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
#------END SNIPPET-----------------------------------------------
The following is my addition:
`/usr/local/bin/nagios_downtime \`date +%s\` $LASTHOSTUP$`
** backticks included **
nagios_downtime - This is a perl script that takes arg1 and arg2 (in
epoch time) and outputs the time that the host was down in the following
format: HH:MM:SS
"date +%s" - prints current time in epoch
"$LASTHOSTUP$" - was *supposed* to print the last time that the host was
in the UP state in epoch time.
The problem that I am running into is this. The $LASTHOSTUP$ is only
usefule *while* the host is down because of the following. When the host
comes back up the value is reset to the current time not the old one
that I needed.
Can anyone think of any other way that they would approach adding a line
that contained how long the host was down for in nagios?
Other info
$ rpm -q nagios redhat-release nagios-plugins
nagios-2.6-1.el4.rf
redhat-release-4AS-5.5
nagios-plugins-1.4.5-1.el4.rf
Thanks
-------------------------------------------------------------------------
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
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