[hobbit] BBALPHAMSG for service 'proc', 'disk', etc no line feeds

Bill Arlofski waa-hobbitml at revpol.com
Fri Apr 4 19:06:50 CEST 2008


Ralph Mitchell wrote:
> On Fri, Apr 4, 2008 at 9:10 AM, Bill Arlofski <waa-hobbitml at revpol.com>
> wrote:
> 
>> Galen Johnson wrote:
>>
>>> I'd be surprised if Hobbit was doing this...
>>>
>> Well, when I was working on my custom email script (mentioned last
>> week), I can see that the $BBALPHAMSG that is handed off to the script
>> by hobbit is exactly what I am seeing in the email, so hobbit is handing
>> it to me (the script) with no formatting, line feeds etc.  I guess I was
>> just wondering if there was some setting in the config file(s) to toggle
>> formatting or something similarly simplistic that I might have missed.
>>
> 
> Are you wrapping $BBALPHAMSG in double quotes in your script??  If you do
> something like:
> 
>     echo $BBALPHAMSG | mailx .....
> 
> that will strip out the linefeeds.  Put quotes around it and you get the
> message verbatim:
> 
>    echo "$BBALPHAMSG" | mailx ....
> 
> Ralph Mitchell
> 


Hi Ralph. Thanks for the reply... Here are the last few lines of my 
hobbit-email-alert.sh script:

--[snip]--
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 | /usr/sbin/sendmail -t
--[snip]--


So, to be certain, the answer to your question is "NO". :)

The BBALPHAMSG variable IS quoted when it was used to build my MSG 
variable, BUT, I did not double-quote the $MSG variable when it gets 
piped to the sendmail wrapper. (But I DID enable the interpretation of 
backslash escapes for the echo command. :)

Changing that last line to:

echo -e "$MSG" | /usr/sbin/sendmail -t

fixed it.

THANK you Ralph. Not sure how I missed that simple one.  :(

Great program, great mailing list.

--
Bill Arlofski
Reverse Polarity, LLC
860-824-2433 Office
860-965-5110 Cell
waa at 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



More information about the Xymon mailing list