To close the loop on this topic, here's the final solution I came up with. This includes instructions.
https://krisspringer.com/posts/xymon-email-alerts.php
Thank You,
Systems Admin
I/O Network Administration
https://www.ionetworkadmin.com
On 7/5/20 7:52 PM, Jeremy Laidman wrote:
Kris
On rare occasions, we enable an SMS alerting script,?using the SMS format. We added to alerts.cfg:
$SendSms=/usr/local/sbin/xymon-sendsms.sh
$Mobile1=0123456789
$Mobile1=0123456798
Then:
HOST=%^hostname00[0-3].example.com <http://example.com> SERVICE=conn
? ? SCRIPT $SendSMS $Mobile1 FORMAT=SMS COLOR=red REPEAT=60 DURATION>10 RECOVERED
? ? SCRIPT $SendSMS $Mobile2 FORMAT=SMS COLOR=red REPEAT=60 DURATION>10 RECOVERED
The script:
#!/bin/sh
# This script is called by the xymon alerts sub-system (see /etc/xymon/alerts.cfg)
# and simply sends an email to an Email -> SMS gateway.
# The email is sent using the smtp-source program due to mail being disabled on the
# Xymon server for security and reliability reasons.
# This script expects the following environmental variables to be set when called:
# BBALPHAMSG ? - The full text of the status log triggering the alert
# RCPT ? ? ? ? - The recipient mobile number.
LogFile="/var/log/xymon/xymon-sendsms.log"
Sender="xymon@`/bin/hostname -f`"
Recipient="$user-5f4667dbacee@xymon.invalid <mailto:user-5f4667dbacee@xymon.invalid>"
Server="smtp.example.org <http://smtp.example.org>"
Subject="Xymon Alert"
Date="`/bin/date`"
Smtp="/usr/sbin/smtp-source"
{
? ? ? ? echo "Subject: $Subject"
? ? ? ? echo "Date: $Date"
? ? ? ? echo "To: $Recipient"
? ? ? ? echo ""
? ? ? ? echo "$BBALPHAMSG"
} | $Smtp -M `hostname -f` -f "$Sender" -t "$Recipient" -F /dev/stdin $Server
echo "$Date" >> $LogFile
echo "$Recipient" >> $LogFile
echo "$BBALPHAMSG" >> $LogFile
echo "" >> $LogFile
On Tue, 19 May 2020 at 07:06, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
Hi, I've been looking into customizing the email alerts that get sent
from our xymon server.? I've played with the SMS option and like the
minimal content of the body of the email, but I still want a
customized
Subject and I want the alert URL included in the email body. I assume
the SCRIPT option will accomplish this.? Does anyone have a simple
script that they can share?
Thanks.
Kris Springer