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 monitoring at whocares.com -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 monitoring at whocares.com -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 monitoring at whocares.com. -t fi
From: Xymon <xymon-bounces at xymon.com> on behalf of Josh Luthman <josh at imaginenetworksllc.com> Sent: Thursday, 5 May 2022 5:47 AM To: Kris Springer <kspringer at innovateteam.com> 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 <kspringer at innovateteam.com<mailto:kspringer at innovateteam.com>> 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 <ahref="/xymon-cgi/svcstatus.sh?CLIENT=myserver.com<http://myserver.com>&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 alerts at someone.who.cares.com<mailto:alerts at someone.who.cares.com> 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 alerts at someone.who.cares.com<mailto:alerts at someone.who.cares.com> 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
Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon
Xymon mailing list Xymon at xymon.com<mailto:Xymon at xymon.com> http://lists.xymon.com/mailman/listinfo/xymon