[Xymon] Xymon notifcations disappear due to base64 encoding
Mark Felder
feld at feld.me
Thu Feb 5 14:40:13 CET 2015
On Wed, Feb 4, 2015, at 19:05, Benjamin Smith wrote:
>
> We've wasted time playing with a wrapper for the mail command that would
> strip
> out the "\r" in the alerts but this has, so far, proven fruitless.
> Messages
> sent via the Sprint SMS gateway go through just fine. Wondering if
> anybody else
> has seen this issue, or has any idea what the best way to handle it might
> be?
>
I warn you this (probably) isn't exactly what you're looking for, but
I've stopped using the SMS email gateways due to reliability issues and
when things are really going bad -- rate limiting. Instead I've moved to
sending my notifications through Pushover.net which sends (fast!!) push
notifications to phones.
You can send messages two ways: their email gateway, or write a
notification script that uses their REST api. It's very simple. I wrote
this in a few minutes and haven't looked back.
#!/bin/sh
# Xymon env notes:
# BBCOLORLEVEL The current color of the status
# BBALPHAMSG The full text of the status log triggering the alert
# ACKCODE The "cookie" that can be used to acknowledge the alert
# RCPT The recipient, from the SCRIPT entry
# BBHOSTNAME The name of the host that the alert is about
# MACHIP The IP-address of the host that has a problem
# BBSVCNAME The name of the service that the alert is about
# BBSVCNUM The numeric code for the service. From SVCCODES
definition.
# BBHOSTSVC HOSTNAME.SERVICE that the alert is about.
# BBHOSTSVCCOMMAS As BBHOSTSVC, but dots in the hostname replaced
with commas
# BBNUMERIC A 22-digit number made by BBSVCNUM, MACHIP and ACKCODE.
# RECOVERED Is "1" if the service has recovered.
# DOWNSECS Number of seconds the service has been down.
# DOWNSECSMSG When recovered, holds the text "Event duration : N"
where N is the DOWNSECS value.
APIKEY="your api key here"
USERKEY="your user key here"
CURL="/usr/local/bin/curl"
URL="https://api.pushover.net/1/messages.json"
# Don't show an ack code if it's 0 (recovered)
[ ${ACKCODE} != 0 ] && ACK="[${ACKCODE}]"
# vm.feld.me:procs red [45595]
MESSAGE=$(cat <<EOF
${BBHOSTNAME}:${BBSVCNAME} ${BBCOLORLEVEL} ${ACK}
See
${XYMONWEBHOST}/cgi-bin/svcstatus.sh?HOST=${BBHOSTNAME}&SERVICE=${BBSVCNAME}
EOF
)
${CURL} -q -s --form-string "token=${APIKEY}" --form-string
"user=${USERKEY}" --form-string "message=${MESSAGE}" ${URL} 1>/dev/null
2>>/var/log/xymon/alert.log
More information about the Xymon
mailing list