[Xymon] custom email alert sample
Jeremy Laidman
jeremy at laidman.org
Mon Jul 6 03:52:20 CEST 2020
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 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="$RCPT at sms.example.org"
Server="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 <kspringer at innovateteam.com>
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
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20200706/dc03be00/attachment.htm>
More information about the Xymon
mailing list