dat attachment in email alert
Geoff Hallford
geoff.hallford at gmail.com
Mon Mar 19 13:44:01 CET 2007
This isn't a question but I am just submitting to the list that when using
the linux 'mail' as most people do, it will sometimes send emails with blank
body's and the actual content in a subject_line.dat file. This is due to
carriage returns not being stripped from certain alert output (like HTTP or
CPU status from Windows machines). The 'mail' command does not know how to
deal with this and will not send properly.
To get rid of this issue you need to create a custom alert script and pipe
the output through translate to remove any carriage returns (because they
are not native to *nix ascii text). An simple example would be (\015
represents a CR):
echo -e "STATUS: RECOVERED\nDATE: `date`\nSYSTEM: $BBHOSTSVC\nDURATION:
$DOWNSECS\nINFO: $BBH_DESCRIPTION\n\n--\n\n$BBALPHAMSG\n\n" | tr -d '\015' |
/usr/bin/mail -s "RECOVERED: $BBHOSTSVC" $RCPT
OR more simply
echo "alert body whatever you want" | tr -d '\015' | /usr/bin/mail -s
"subject of email" recipient_of_email
The important part is the [ tr -d '\015' ] to delete all CR's in the message
before it's piped to mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20070319/c7f5dc45/attachment.html>
More information about the Xymon
mailing list