Xymon Mailing List Archive search

BBALPHAMSG for service 'proc', 'disk', etc no line feeds

6 messages in this thread

list Bill Arlofski · Sun, 30 Mar 2008 12:05:00 -0400 ·
Is there a way to get hobbit to send the BBALPHAMSG variable formatted
with line feeds so it appears in an email the way it does on the web page?

I guess what I am trying to say is that would be much easier to read
this in an email report:

--[snip]--
server.domain.tld:procs yellow [584104]

yellow Sun Mar 30 10:53:38 EDT 2008 - Processes NOT ok

green arkeiad (found 1, req. between 1 and 1)
green ntpd (found 1, req. between 1 and 1)
green apache2 (found 8, req. 1 or more)
green cron (found 1, req. 1 or more)
red   syslog-ng (found 1, req. 1 or more)
green sshd (found 3, req. 1 or more)
green slapd (found 1, req. 1 or more)

  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:01 init [3]
    2 ?        S      0:00 [migration/0]
    3 ?        SN     0:00 [ksoftirqd/0]
    4 ?        S      0:00 [migration/1]
--[snip]--


as opposed to what I am seeing for a proc report in an email:

--[snip]--
server.domain.tld:procs yellow [584104] yellow Sun Mar 30 10:53:38 EDT
2008 - Processes NOT ok &green arkeiad (found 1, req. between 1 and 1)
&yellow ntpd (found 0, req. between 1 and 1) &green apache2 (found 8,
req. 1 or more) &green cron (found 1, req. 1 or more) &green syslog-ng
(found 1, req. 1 or more) &green sshd (found 3, req. 1 or more) &green
slapd (found 1, req. 1 or more) PID PPID USER STARTED S PRI %CPU TIME
%MEM RSZ VSZ CMD 1 0 root Feb 13 S 23 0.0 00:00:01 0.0 552 1600 init [3]
2 1 root Feb 13 S 139 0.0 00:00:00 0.0 0 0 [migration/0] 3 1 root Feb 13
S 5 0.0 00:00:00 0.0 0 0 [ksoftirqd/0] 4 1 root Feb 13 S 139 0.0
00:00:00 0.0 0 0 [migration/1]
--[snip]--

I see similarly unformatted reports for disk partitions.


Since there is nothing really to queue off of in the globbed together
BBALPHAMSG variable, it is also impossible for me to use sed/awk to
manipulate it and format it before emailing..

Any thoughts or comments?  Did I miss something obvious?

Thanks!

--
Bill Arlofski
Reverse Polarity, LLC
list Galen Johnson · Sun, 30 Mar 2008 18:09:50 -0400 ·
I'd be surprised if Hobbit was doing this...if you're using Lookout as your mail reader, see if there is a message about extra line breaks being removed.  There should be a link to re-add them (I've never understood why Bill and company felt you would ever want to see your email other than how it eas sent).

=G=
quoted from Bill Arlofski

From: Bill Arlofski [user-1203bb90b638@xymon.invalid]
Sent: Sunday, March 30, 2008 12:05 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] BBALPHAMSG for service 'proc', 'disk', etc no line feeds

Is there a way to get hobbit to send the BBALPHAMSG variable formatted
with line feeds so it appears in an email the way it does on the web page?

I guess what I am trying to say is that would be much easier to read
this in an email report:

--[snip]--
server.domain.tld:procs yellow [584104]

yellow Sun Mar 30 10:53:38 EDT 2008 - Processes NOT ok

green arkeiad (found 1, req. between 1 and 1)
green ntpd (found 1, req. between 1 and 1)
green apache2 (found 8, req. 1 or more)
green cron (found 1, req. 1 or more)
red   syslog-ng (found 1, req. 1 or more)
green sshd (found 3, req. 1 or more)
green slapd (found 1, req. 1 or more)

  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:01 init [3]
    2 ?        S      0:00 [migration/0]
    3 ?        SN     0:00 [ksoftirqd/0]
    4 ?        S      0:00 [migration/1]
--[snip]--


as opposed to what I am seeing for a proc report in an email:

--[snip]--
server.domain.tld:procs yellow [584104] yellow Sun Mar 30 10:53:38 EDT
2008 - Processes NOT ok &green arkeiad (found 1, req. between 1 and 1)
&yellow ntpd (found 0, req. between 1 and 1) &green apache2 (found 8,
req. 1 or more) &green cron (found 1, req. 1 or more) &green syslog-ng
(found 1, req. 1 or more) &green sshd (found 3, req. 1 or more) &green
slapd (found 1, req. 1 or more) PID PPID USER STARTED S PRI %CPU TIME
%MEM RSZ VSZ CMD 1 0 root Feb 13 S 23 0.0 00:00:01 0.0 552 1600 init [3]
2 1 root Feb 13 S 139 0.0 00:00:00 0.0 0 0 [migration/0] 3 1 root Feb 13
S 5 0.0 00:00:00 0.0 0 0 [ksoftirqd/0] 4 1 root Feb 13 S 139 0.0
00:00:00 0.0 0 0 [migration/1]
--[snip]--

I see similarly unformatted reports for disk partitions.


Since there is nothing really to queue off of in the globbed together
BBALPHAMSG variable, it is also impossible for me to use sed/awk to
manipulate it and format it before emailing..

Any thoughts or comments?  Did I miss something obvious?

Thanks!

--
Bill Arlofski
Reverse Polarity, LLC
list Bill Arlofski · Sun, 30 Mar 2008 18:18:42 -0400 ·
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.

And no. Not a chance that I am using Outlook. Microsoft products are not and have not been allowed on my network since 1991. :)


--
Bill Arlofski
Reverse Polarity, LLC
* 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
list Bill Arlofski · Fri, 04 Apr 2008 10:10:16 -0400 ·
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.

And no. Not a chance that I am using Outlook. Microsoft products are not
and have not been allowed on my network since 1991. :)


--
Bill Arlofski
Reverse Polarity, LLC
* 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
list Ralph Mitchell · Fri, 4 Apr 2008 10:25:51 -0500 ·
On Fri, Apr 4, 2008 at 9:10 AM, Bill Arlofski <user-0b8af203a56e@xymon.invalid>
quoted from Bill Arlofski
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
list Bill Arlofski · Fri, 04 Apr 2008 13:06:50 -0400 ·
quoted from Ralph Mitchell
Ralph Mitchell wrote:
On Fri, Apr 4, 2008 at 9:10 AM, Bill Arlofski <user-0b8af203a56e@xymon.invalid>
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
XXX-XXX-XXXX Office
XXX-XXX-XXXX Cell
user-365ea0c1c159@xymon.invalid
quoted from Bill Arlofski
* 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