[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] How to customize the subject line in Alert E-mail
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] How to customize the subject line in Alert E-mail
- From: Bill Arlofski <waa-hobbitml (at) revpol.com>
- Date: Wed, 10 Sep 2008 11:47:22 -0400
- Organization: Reverse Polarity, LLC
- References: <77d16bd80809100516h62ee719bg1ae1ce6f7f53d314 (at) mail.gmail.com>
- User-agent: Thunderbird 2.0.0.16 (X11/20080817)
VPN Cluster wrote:
How to customize the contents of the subject line in alerts and recovery
e-mails.
Below is a simple/sample alert script I use.
Tell hobbit to use your script by editing your
~hobbit/server/etc/hobbit-alerts.cfg file and set the recipient of your alerts
to a SCRIPT instead of MAIL like so:
HOST=*
SCRIPT /usr/local/sbin/hobbit-alert.sh FORMAT=SCRIPT DURATION>5m REPEAT=2h
Here's my /usr/local/sbin/hobbit-alert.sh script. Modify as you see fit. The
SUBJECT line in this email will wrap. Put it all on one line.
Hope this helps.
--[snip]--
#!/bin/bash
#
# waa - 20080325
# --------------
SM="/usr/bin/sendmail"
DATE=`date +%Y%m%d-%H%M%S`
FROM="From: ClientSiteName Hobbit Server <some-email (at) example.com>"
TO="To: some-email (at) example.com"
if [ "$RECOVERED" = "1" ]; then
RECOVERED="(Recovered)"
else
RECOVERED=""
fi
SUBJECT="Subject: Hobbit Alert - ($BBCOLORLEVEL) $BBSVCNAME on $BBHOSTNAME at
$DATE for $DOWNSECS seconds $RECOVERED"
MSG="$FROM\n$TO\n$SUBJECT\n\nDown for: $DOWNSECS Seconds\n\n$BBALPHAMSG\n"
echo -e "$MSG" | $SM -t
--[snip]--
--
Bill Arlofski
Reverse Polarity, LLC
http://www.revpol.com/
* Stop the NSA from illegally eavesdropping on your personal email *
Learn about PGP and start encrypting your email today
http://gnupg.org or http://www.pgp.com