<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div dir="ltr" style="">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello all,</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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!</div>
<div id="appendonsend" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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.</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Another question on xymon alerts... what is the significance of the ampersand in "&red" in an alert message? </div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Jonathan</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
#!/bin/sh
<div><br>
</div>
<div>NOTICE=`echo "$BBALPHAMSG" | grep -c INFO`</div>
<div><br>
</div>
<div class="elementToProof">if [ $RECOVERED -eq 1 ];</div>
<div>then</div>
<div>        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME is Recovered\nContent-Type: text/html\n</div>
<div class="elementToProof"><html> </div>
<div class="elementToProof"><b>HTML HERE</b></div>
<div class="elementToProof"></html>" | sendmail -f monitoring@whocares.com -t</div>
<div>elif [ $NOTICE -gt 0 ];</div>
<div>then</div>
<div class="elementToProof">        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME - Notice\nContent-Type: text/html\n  </div>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="margin:0px;background-color:rgb(255, 255, 255)"><html> </span></div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div style="margin:0px;background-color:rgb(255, 255, 255)" class="elementToProof">
<b>HTML HERE</b></div>
<span style="margin:0px;background-color:rgb(255, 255, 255)"></html></span>
<div>" | sendmail -f monitoring@whocares.com -t</div>
<div>else</div>
<div class="elementToProof">        echo -e "To: $RCPT\nSubject: $BBSVCNAME on $BBHOSTNAME is $BBCOLORLEVEL\nContent-Type: text/html\n       </div>
<span style="margin:0px;background-color:rgb(255, 255, 255)"><html> </span>
<div style="margin:0px;background-color:rgb(255, 255, 255)"><b>HTML HERE</b></div>
<span style="margin:0px;background-color:rgb(255, 255, 255)"></html></span>
<div>" | sendmail -f monitoring@whocares.com. -t</div>
fi
<div></div>
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="elementToProof" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr" style=""><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt" class="elementToProof"><b>From:</b> Xymon <xymon-bounces@xymon.com> on behalf of Josh Luthman <josh@imaginenetworksllc.com><br>
<b>Sent:</b> Thursday, 5 May 2022 5:47 AM<br>
<b>To:</b> Kris Springer <kspringer@innovateteam.com><br>
<b>Cc:</b> xymon@xymon.com <xymon@xymon.com><br>
<b>Subject:</b> Re: [Xymon] Trouble With Alert Format</font>
<div> </div>
</div>
<div style="">
<div dir="ltr">Kris,
<div><br>
</div>
<div>I would love to see Slack alerts if you wouldn't mind.</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, May 4, 2022 at 12:54 PM Kris Springer <<a href="mailto:kspringer@innovateteam.com" data-auth="NotApplicable" style="">kspringer@innovateteam.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
Here's some details of how I send email alerts. They're completely <br>
customizable.  Hope it helps.<br>
<a href="http://www.krisspringer.com/posts/xymon-email-alerts.php" data-auth="NotApplicable" style="">http://www.krisspringer.com/posts/xymon-email-alerts.php</a><br>
<br>
I have since switched to Slack alerts instead of emails, but those are a <br>
bit more complex. Let me know if you want instructions for that.<br>
<br>
Kris Springer<br>
<br>
<br>
On 5/4/22 09:38, Adam Thorn wrote:<br>
> On 04/05/2022 12:22, Jonathan Bishop wrote:<br>
>> Hello fellow xymoners,<br>
>><br>
>> I have recently setup monitoring of the existence of files in a <br>
>> particular directory, and this seems to be working well. When I setup <br>
>> an alert for a "red" condition, I receive an email message with what <br>
>> appears to be some html tags within it, eg:<br>
>><br>
>>        &red <a <br>
>> href="/xymon-cgi/svcstatus.sh?CLIENT=<a href="http://myserver.com" data-auth="NotApplicable" style="">myserver.com</a>&amp;SECTION=file:/path/to/myfile">/path/to/myfile</a><br>
>>        File is a  - should be file<br>
>><br>
>> I have tried setting the alert "FORMAT" to TEXT, PLAIN and SMS, but <br>
>> this doesn't seem to have any effect. I have also tried sending the <br>
>> alert through the <a href="http://html_mail.pl" data-auth="NotApplicable" style="">
html_mail.pl</a> extension scripts, and this doesn't <br>
>> seem to have any effect either. All I really want is a plain text <br>
>> message, which is easy to read. Does anyone know how I could clean <br>
>> this up?<br>
>><br>
>> Example Alert Config:<br>
>> HOST=<a href="http://myserver.com" data-auth="NotApplicable" style="">myserver.com</a><br>
>>          MAIL <a href="mailto:alerts@someone.who.cares.com" data-auth="NotApplicable" style="">
alerts@someone.who.cares.com</a> REPEAT=240m COLOR=red <br>
>> FORMAT=TEXT<br>
><br>
> This may be a red herring, but I wonder if you could try changing the <br>
> order of the different parts of the config line to e.g.<br>
><br>
> HOST=<a href="http://myserver.com" data-auth="NotApplicable" style="">myserver.com</a> COLOR=red MAIL
<a href="mailto:alerts@someone.who.cares.com" data-auth="NotApplicable" style="">
alerts@someone.who.cares.com</a> <br>
> FORMAT=TEXT REPEAT=240m<br>
><br>
> Quoting selectively from the stock comments at the top of my <br>
> alerts.cfg file ....<br>
><br>
> This file is made up from RULES and RECIPIENTS.<br>
> A RULE is a filter made from ... (etc etc)<br>
> A RECIPIENT can be a MAIL address, or a SCRIPT. Recipients can also <br>
> have rules associated with them...<br>
><br>
> ..so for your rule, HOST and COLOR constitute the "RULE", MAIL is the <br>
> "RECIPIENT", and REPEAT and FORMAT then modify the "RECIPIENT". Your <br>
> rule mixes together tokens from the RULE and RECIPIENT parts, which <br>
> might lead to the config rule not being parsed properly.<br>
><br>
> (Or maybe this is nonsense and the order doesn't matter here; I <br>
> suspect it would take a careful reading of the source to see how the <br>
> different tokens in that config file get parsed)<br>
><br>
> Adam<br>
> _______________________________________________<br>
> Xymon mailing list<br>
> <a href="mailto:Xymon@xymon.com" data-auth="NotApplicable" style="">Xymon@xymon.com</a><br>
> <a href="http://lists.xymon.com/mailman/listinfo/xymon" data-auth="NotApplicable" style="">
http://lists.xymon.com/mailman/listinfo/xymon</a><br>
<br>
_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com" data-auth="NotApplicable" style="">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" data-auth="NotApplicable" style="">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</blockquote>
</div>
</div>
</div>
</body>
</html>