Xymon Mailing List Archive search

Trouble With Alert Format

8 messages in this thread

list Jonathan Bishop · Wed, 4 May 2022 11:22:01 +0000 ·
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a particular directory, and this seems to be working well. When I setup an alert for a "red" condition, I receive an email message with what appears to be some html tags within it, eg:

        &red <a href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>
        File is a  - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but this doesn't seem to have any effect. I have also tried sending the alert through the html_mail.pl extension scripts, and this doesn't seem to have any effect either. All I really want is a plain text message, which is easy to read. Does anyone know how I could clean this up?

Example Alert Config:
HOST=myserver.com
        MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red FORMAT=TEXT

Regards,
Jonathan
list Adam Thorn · Wed, 4 May 2022 16:38:43 +0100 ·
quoted from Jonathan Bishop
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a particular directory, and this seems to be working well. When I setup an alert for a "red" condition, I receive an email message with what appears to be some html tags within it, eg:

 ? ? ? &red <a href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>
 ? ? ? File is a? - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but this doesn't seem to have any effect. I have also tried sending the alert through the html_mail.pl extension scripts, and this doesn't seem to have any effect either. All I really want is a plain text message, which is easy to read. Does anyone know how I could clean this up?

Example Alert Config:
HOST=myserver.com
 ? ? ? ? MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red FORMAT=TEXT
This may be a red herring, but I wonder if you could try changing the order of the different parts of the config line to e.g.

HOST=myserver.com COLOR=red MAIL user-28ac44e05df5@xymon.invalid FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the "RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your rule mixes together tokens from the RULE and RECIPIENT parts, which might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I suspect it would take a careful reading of the source to see how the different tokens in that config file get parsed)

Adam
list Kris Springer · Wed, 4 May 2022 09:59:19 -0600 ·
Here's some details of how I send email alerts. They're completely customizable.? Hope it helps.
http://www.krisspringer.com/posts/xymon-email-alerts.php

I have since switched to Slack alerts instead of emails, but those are a bit more complex. Let me know if you want instructions for that.

Kris Springer
quoted from Adam Thorn


On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a particular directory, and this seems to be working well. When I setup an alert for a "red" condition, I receive an email message with what appears to be some html tags within it, eg:

?? ? ? &red <a href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>
?? ? ? File is a? - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but this doesn't seem to have any effect. I have also tried sending the alert through the html_mail.pl extension scripts, and this doesn't seem to have any effect either. All I really want is a plain text message, which is easy to read. Does anyone know how I could clean this up?

Example Alert Config:
HOST=myserver.com
?? ? ? ? MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red FORMAT=TEXT
This may be a red herring, but I wonder if you could try changing the order of the different parts of the config line to e.g.

HOST=myserver.com COLOR=red MAIL user-28ac44e05df5@xymon.invalid FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the "RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your rule mixes together tokens from the RULE and RECIPIENT parts, which might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I suspect it would take a careful reading of the source to see how the different tokens in that config file get parsed)

Adam
list Josh Luthman · Wed, 4 May 2022 13:47:32 -0400 ·
Kris,

I would love to see Slack alerts if you wouldn't mind.

On Wed, May 4, 2022 at 12:54 PM Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
quoted from Kris Springer
wrote:
Here's some details of how I send email alerts. They're completely
customizable.  Hope it helps.
http://www.krisspringer.com/posts/xymon-email-alerts.php

I have since switched to Slack alerts instead of emails, but those are a
bit more complex. Let me know if you want instructions for that.

Kris Springer


On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a
particular directory, and this seems to be working well. When I setup
an alert for a "red" condition, I receive an email message with what
appears to be some html tags within it, eg:

       &red <a

href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com
&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>
quoted from Kris Springer
       File is a  - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but
this doesn't seem to have any effect. I have also tried sending the
alert through the html_mail.pl extension scripts, and this doesn't
seem to have any effect either. All I really want is a plain text
message, which is easy to read. Does anyone know how I could clean
this up?

Example Alert Config:
HOST=myserver.com
         MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red
FORMAT=TEXT
This may be a red herring, but I wonder if you could try changing the
order of the different parts of the config line to e.g.

HOST=myserver.com COLOR=red MAIL user-28ac44e05df5@xymon.invalid
FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my
alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also
have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the
"RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your
rule mixes together tokens from the RULE and RECIPIENT parts, which
might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I
suspect it would take a careful reading of the source to see how the
different tokens in that config file get parsed)

Adam
list Kris Springer · Thu, 5 May 2022 07:36:45 -0600 ·
Here's my Slack Alert instructions.
http://www.krisspringer.com/posts/xymon-slack-alerts.php

Kris Springer
quoted from Josh Luthman


On 5/4/22 11:47, Josh Luthman wrote:
Kris,

I would love to see Slack alerts if you wouldn't mind.

On Wed, May 4, 2022 at 12:54 PM Kris Springer 
<user-c2caa0a7a8d5@xymon.invalid> wrote:

    Here's some details of how I send email alerts. They're completely
    customizable.? Hope it helps.
    http://www.krisspringer.com/posts/xymon-email-alerts.php

    I have since switched to Slack alerts instead of emails, but those
    are a
    bit more complex. Let me know if you want instructions for that.

    Kris Springer


    On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a
particular directory, and this seems to be working well. When I
    setup
an alert for a "red" condition, I receive an email message with
    what
appears to be some html tags within it, eg:

?? ? ? &red <a
href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com
    <http://myserver.com>&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>;
quoted from Josh Luthman
?? ? ? File is a? - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS,
    but
this doesn't seem to have any effect. I have also tried sending
    the

alert through the html_mail.pl <http://html_mail.pl>; extension
quoted from Josh Luthman
    scripts, and this doesn't
seem to have any effect either. All I really want is a plain text
message, which is easy to read. Does anyone know how I could clean
this up?

Example Alert Config:

HOST=myserver.com <http://myserver.com>;
quoted from Josh Luthman
?? ? ? ? MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red
FORMAT=TEXT
This may be a red herring, but I wonder if you could try
    changing the
order of the different parts of the config line to e.g.

HOST=myserver.com <http://myserver.com>; COLOR=red MAIL
quoted from Josh Luthman
    user-28ac44e05df5@xymon.invalid
FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my
alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also
have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL
    is the
"RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT".
    Your
rule mixes together tokens from the RULE and RECIPIENT parts, which
might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I
suspect it would take a careful reading of the source to see how
    the
different tokens in that config file get parsed)

Adam
list Josh Luthman · Thu, 5 May 2022 10:40:23 -0400 ·
Fantastic guide, thank you!

Just a little gotcha: when copy/paste the guide is offering line breaks
which causes issues.  The cat's text:alert line pastes with a line break
and that makes the post look like code instead of a pretty link/a href.
Your shell script should NOT have a line break after the pipe.

On Thu, May 5, 2022 at 9:36 AM Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
quoted from Kris Springer
wrote:
Here's my Slack Alert instructions.
http://www.krisspringer.com/posts/xymon-slack-alerts.php

Kris Springer


On 5/4/22 11:47, Josh Luthman wrote:

Kris,

I would love to see Slack alerts if you wouldn't mind.

On Wed, May 4, 2022 at 12:54 PM Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
wrote:
Here's some details of how I send email alerts. They're completely
customizable.  Hope it helps.
http://www.krisspringer.com/posts/xymon-email-alerts.php

I have since switched to Slack alerts instead of emails, but those are a
bit more complex. Let me know if you want instructions for that.

Kris Springer


On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a
particular directory, and this seems to be working well. When I setup
an alert for a "red" condition, I receive an email message with what
appears to be some html tags within it, eg:

       &red <a

href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com&amp;SECTION=
file:/path/to/myfile">/path/to/myfile</a>
quoted from Kris Springer
       File is a  - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but
this doesn't seem to have any effect. I have also tried sending the
alert through the html_mail.pl extension scripts, and this doesn't
seem to have any effect either. All I really want is a plain text
message, which is easy to read. Does anyone know how I could clean
this up?

Example Alert Config:
HOST=myserver.com
         MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m COLOR=red
FORMAT=TEXT
This may be a red herring, but I wonder if you could try changing the
order of the different parts of the config line to e.g.

HOST=myserver.com COLOR=red MAIL user-28ac44e05df5@xymon.invalid
FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my
alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also
have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the
"RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your
rule mixes together tokens from the RULE and RECIPIENT parts, which
might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I
suspect it would take a careful reading of the source to see how the
different tokens in that config file get parsed)

Adam
list Kris Springer · Thu, 5 May 2022 08:54:32 -0600 ·
Yes, I have had issues with line breaks and spaces when copy/pasting.? 
Also quotation marks sometimes get screwed up when copying from how-to's 
with certain fonts.? If things don't work when copy/pasting, always 
check line breaks, spaces, and quotation marks.

Kris Springer
quoted from Josh Luthman


On 5/5/22 08:40, Josh Luthman wrote:
Fantastic guide, thank you!

Just a little gotcha: when copy/paste the guide is offering line 
breaks which causes issues.? The cat's text:alert line pastes with a 
line break and that makes the post look like code instead of a pretty 
link/a href.? Your shell script should NOT have a line break after the 
pipe.

On Thu, May 5, 2022 at 9:36 AM Kris Springer 
<user-c2caa0a7a8d5@xymon.invalid> wrote:

    Here's my Slack Alert instructions.
    http://www.krisspringer.com/posts/xymon-slack-alerts.php

    Kris Springer


    On 5/4/22 11:47, Josh Luthman wrote:
    Kris,

    I would love to see Slack alerts if you wouldn't mind.

    On Wed, May 4, 2022 at 12:54 PM Kris Springer
    <user-c2caa0a7a8d5@xymon.invalid> wrote:

        Here's some details of how I send email alerts. They're
        completely
        customizable.? Hope it helps.
        http://www.krisspringer.com/posts/xymon-email-alerts.php

        I have since switched to Slack alerts instead of emails, but
        those are a
        bit more complex. Let me know if you want instructions for that.

        Kris Springer


        On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files
        in a
particular directory, and this seems to be working well.
        When I setup
an alert for a "red" condition, I receive an email message
        with what
appears to be some html tags within it, eg:

?? ? ? &red <a
href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com
        <http://myserver.com>&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>;
?? ? ? File is a? - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and
        SMS, but
this doesn't seem to have any effect. I have also tried
        sending the
alert through the html_mail.pl <http://html_mail.pl>;
        extension scripts, and this doesn't
seem to have any effect either. All I really want is a
        plain text
message, which is easy to read. Does anyone know how I
        could clean
this up?

Example Alert Config:
HOST=myserver.com <http://myserver.com>;
?? ? ? ? MAIL user-28ac44e05df5@xymon.invalid REPEAT=240m
        COLOR=red
FORMAT=TEXT
This may be a red herring, but I wonder if you could try
        changing the
order of the different parts of the config line to e.g.

HOST=myserver.com <http://myserver.com>; COLOR=red MAIL
        user-28ac44e05df5@xymon.invalid
FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my
alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients
        can also
have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE",
        MAIL is the
"RECIPIENT", and REPEAT and FORMAT then modify the
        "RECIPIENT". Your
rule mixes together tokens from the RULE and RECIPIENT
        parts, which
might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter
        here; I
suspect it would take a careful reading of the source to
        see how the
different tokens in that config file get parsed)

Adam
list Jonathan Bishop · Fri, 6 May 2022 03:02:55 +0000 ·
Hello all,

Thank you for your responses. You have highlighted to me that firstly, I lacked a proper understanding of how mime types and mime headers work in email, and secondly that the mail utility on RHEL 7 doesn't support changing mime types!

To work around the problem, I borrowed Kris's script and used sendmail to send the email instead. I then set manually the "Content-Type" header to "text/html". Below is an example of something that works for me on RHEL7.

Another question on xymon alerts... what is the significance of the ampersand in "&red" in an alert message?

Regards,
Jonathan

#!/bin/sh

NOTICE=`echo "$BBALPHAMSG" | grep -c INFO`

if [ $RECOVERED -eq 1 ];
then
        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME is Recovered\nContent-Type: text/html\n
<html>
<b>HTML HERE</b>
</html>" | sendmail -f user-e1650b6dc622@xymon.invalid -t
elif [ $NOTICE -gt 0 ];
then
        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME - Notice\nContent-Type: text/html\n
<html>
<b>HTML HERE</b>
</html>
" | sendmail -f user-e1650b6dc622@xymon.invalid -t
else
        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME is $BBCOLORLEVEL\nContent-Type: text/html\n
<html>
<b>HTML HERE</b>
</html>
" | sendmail -f user-e1650b6dc622@xymon.invalid. -t
fi
quoted from Josh Luthman


From: Xymon <xymon-bounces at xymon.com> on behalf of Josh Luthman <user-4c45a83f15cb@xymon.invalid>
Sent: Thursday, 5 May 2022 5:47 AM
To: Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
Cc: xymon at xymon.com <xymon at xymon.com>
Subject: Re: [Xymon] Trouble With Alert Format

Kris,

I would love to see Slack alerts if you wouldn't mind.

On Wed, May 4, 2022 at 12:54 PM Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
Here's some details of how I send email alerts. They're completely
customizable.  Hope it helps.
http://www.krisspringer.com/posts/xymon-email-alerts.php

I have since switched to Slack alerts instead of emails, but those are a
bit more complex. Let me know if you want instructions for that.

Kris Springer


On 5/4/22 09:38, Adam Thorn wrote:
On 04/05/2022 12:22, Jonathan Bishop wrote:
Hello fellow xymoners,

I have recently setup monitoring of the existence of files in a
particular directory, and this seems to be working well. When I setup
an alert for a "red" condition, I receive an email message with what
appears to be some html tags within it, eg:

       &red <a

href="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com<http://myserver.com>&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a>;
quoted from Kris Springer
       File is a  - should be file

I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but
this doesn't seem to have any effect. I have also tried sending the

alert through the html_mail.pl<http://html_mail.pl>; extension scripts, and this doesn't
quoted from Kris Springer
seem to have any effect either. All I really want is a plain text
message, which is easy to read. Does anyone know how I could clean
this up?

Example Alert Config:

HOST=myserver.com<http://myserver.com>;
         MAIL user-28ac44e05df5@xymon.invalid<mailto:user-28ac44e05df5@xymon.invalid> REPEAT=240m COLOR=red
quoted from Kris Springer
FORMAT=TEXT
This may be a red herring, but I wonder if you could try changing the
order of the different parts of the config line to e.g.

HOST=myserver.com<http://myserver.com>; COLOR=red MAIL user-28ac44e05df5@xymon.invalid<mailto:user-28ac44e05df5@xymon.invalid>
quoted from Kris Springer
FORMAT=TEXT REPEAT=240m

Quoting selectively from the stock comments at the top of my
alerts.cfg file ....

This file is made up from RULES and RECIPIENTS.
A RULE is a filter made from ... (etc etc)
A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also
have rules associated with them...

..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the
"RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your
rule mixes together tokens from the RULE and RECIPIENT parts, which
might lead to the config rule not being parsed properly.

(Or maybe this is nonsense and the order doesn't matter here; I
suspect it would take a careful reading of the source to see how the
different tokens in that config file get parsed)

Adam