[hobbit] HTML Code in Alerts
Taylor, Robert
Robert.Taylor at HendrickAuto.com
Mon Mar 6 15:25:57 CET 2006
Chris,
I don't believe that Hobbit will send HTML alerts. If you want to do this you will need to use a custom notification script for each test that provides HTML alerts. I use the following script for mine...
############################################################
# The following is an HTML alert script. Place it in your #
# ext directory as -email-notification.sh. #
############################################################
sendmail="/usr/sbin/sendmail"
bbserveraddress="http://<HOST NAME>"
echo $BBCOLORLEVEL
echo $RECOVERED
echo "$BBALPHAMSG" >$BBTMP/originalmessage.$$
lines=`wc -l $BBTMP/originalmessage.$$ | awk '{print $1}'`
rowtail=$(($lines -1))
rowhead=$(($lines -3))
tail -n $rowtail $BBTMP/originalmessage.$$ | head -n $rowhead > $BBTMP/temp.$$
#echo $lines
echo "To: $RCPT" >$BBTMP/notification.$$
case $RECOVERED in
0)
case $BBCOLORLEVEL in
red)
echo "Subject: Hobbit [${ACKCODE}] $BBHOSTNAME:$BBSVCNAME CRITICAL (RED)" >>$BBTMP/notification.$$
;;
yellow)
echo "Subject: Hobbit [${ACKCODE}] $BBHOSTNAME:$BBSVCNAME warning (YELLOW)" >>$BBTMP/notification.$$
;;
green)
echo"Subject: Hobbit [${ACKCODE}] $BBHOSTNAME:$BBSVCNAME okay (GREEN)" >>$BBTMP/notification.$$
;;
esac
echo "Content-Type: text/html; charset=\"us-ascii\"
<BODY BGCOLOR=\"$BBCOLORLEVEL\" BACKGROUND=\"$bbserveraddress/hobbit/gifs/bkg-$BBCOLORLEVEL.gif\" TEXT=\"#FFFFCC\" LINK=\"#00FFAA\" VLINK=\"#FFFF44\">" >>$BBTMP/notification.$$
;;
1)
echo "Subject: Hobbit $BBHOSTNAME:$BBSVCNAME recovered
Content-Type: text/html; charset=\"us-ascii\"
<BODY BGCOLOR=\"green\" BACKGROUND=\"$bbserveraddress/hobbit/gifs/bkg-green.gif\" TEXT=\"#FFFFCC\" LINK=\"#00FFAA\" VLINK=\"#FFFF44\">" >>$BBTMP/notification.$$
;;
esac
cat $BBTMP/temp.$$ >>$BBTMP/notification.$$
echo "<center>
<p>Please see: <a href=\"$bbserveraddress/hobbit-cgi/bb-hostsvc.sh?HOSTSVC=$BBHOSTSVCCOMMAS\">Service Details</a>
</p>
</center>" >>$BBTMP/notification.$$
$sendmail $RCPT <$BBTMP/notification.$$
rm -rf $BBTMP/*.$$
exit 1
Then put the following in your hobbit-alerts.cfg file
HOST=* SERVICE=mrtg RECOVERED COLOR=red
SCRIPT /home/hobbit/server/ext/html-email-notification.sh <EMAIL ADDRESS>
Also, I typically put the HTML alert tests in the EXSERVICE value of my other alerts. That way it doesn't send out the text alerts and only sends out the HTML ones.
I am no programmer so there may be better ways to accomplish what I did, but it works great and I am happy with it.
Robert Taylor | Senior Manager of Information Systems | Hendrick Automotive Group
Mobile Phone (704) 241-4432 | NC Office (704) 566-3380 | NC Fax (704) 566-3341
-----Original Message-----
From: Chris Blank [mailto:CBlank at abcgroup.com]
Sent: Monday, March 06, 2006 8:39 AM
To: hobbit at hswn.dk
Subject: [hobbit] HTML Code in Alerts
I am using server custom scripts that return HTML code to the hobbit for
displaying. One of which is bbmrtg! I upgraded the latest snapshot
because of another e-mail stating that it was patched in RC2. I am
still getting the following:
red Sun Feb 26 03:12:35 2006
&red<A
HREF="http://10.32.1.48/cgi-bin/routers2.cgi?rtr=master.cfg&bars=Cami&pa
ge=graph&xgtype=dwmy&xgstyle=l2&if=mrtg.10.32.3.229.mult1&xmtype=options
">Traffic Analysis for Multilink 1 Ranson to Orange:</A> In: 333800
bytes/sec (86.5%) Out: 10590 bytes/sec (2.7%) <CENTER><BR><A
HREF="http://10.32.1.48/cgi-bin/routers2.cgi?rtr=master.cfg&bars=Cami&pa
ge=graph&xgtype=dwmy&xgstyle=l2&if=mrtg.10.32.3.229.mult1&xmtype=options
"><IMG
SRC="http://10.32.1.48/cgi-bin/routers2.cgi?rtr=master.cfg&if=mrtg.10.32
.3.229.mult1&xgtype=d&page=image" ALT="Last 24 Hours"
BORDER=0></A><BR></CENTER> <TABLE BORDER=1 ALIGN=CENTER> <TR>
<TH COLSPAN=6><B>Rules</B></TH>
</TR>
<TR>
<TD><FONT COLOR=#00eb0c><B>In</B></FONT></TD>
<TD BGCOLOR=red><FONT COLOR=black><B>< 0.0%</B></FONT></TD>
<TD BGCOLOR=yellow><FONT COLOR=black><B>< 0.0%</B></FONT></TD>
<TD BGCOLOR=green><FONT COLOR=black><B>0.0% - 60.0%</B></FONT></TD>
<TD BGCOLOR=yellow><FONT COLOR=black><B>> 60.0%</B></FONT></TD>
<TD BGCOLOR=red><FONT COLOR=black><B>> 80.0%</B></FONT></TD> </TR>
<TR>
<TD><FONT COLOR=#1000ff><B>Out</B></FONT></TD>
<TD BGCOLOR=red><FONT COLOR=black><B>< 0.0%</B></FONT></TD>
<TD BGCOLOR=yellow><FONT COLOR=black><B>< 0.0%</B></FONT></TD>
<TD BGCOLOR=green><FONT COLOR=black><B>0.0% - 60.0%</B></FONT></TD>
<TD BGCOLOR=yellow><FONT COLOR=black><B>> 60.0%</B></FONT></TD>
<TD BGCOLOR=red><FONT COLOR=black><B>> 80.0%</B></FONT></TD> </TR>
</TABLE> <BR>
How can I get the Hobbit to send everything as HTML formatted e-mails
vice text?
Chris Blank
Network Engineer
AB&C Group
(304) 725-7050 x 2221
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list