blank recovered sms alerts on mail
Hi,
I am getting blank sms alerts for RECOVERED messages but for yellow or red the alerts are coming correctly. Could you tell me whats going wrong ?
My xymon version is : - 4.3.10
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Can anyone tell where should I look ?
On Tue, May 21, 2013 at 5:36 PM, deepak deore <deepakdeore2004 at gmail.com>wrote:
Hi,
I am getting blank sms alerts for RECOVERED messages but for yellow or red the alerts are coming correctly. Could you tell me whats going wrong ?
My xymon version is : - 4.3.10
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com> wrote:
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
Yes, all 3 recipients have the same problem. alert.log has "Null message body; hope that's ok" message. I am using win7 with outlook 2010, MTA is amazon SES.
On Thu, May 23, 2013 at 5:26 AM, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com> wrote:
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
What's the OS that Xymon is running on?
What mail system runs on the Xymon server?
Xymon will probably execute the binary /usr/bin/mail. What is /usr/bin/mail? Is it mailx or mutt or something else? On RedHat/Fedora/Centos/SUSE you can type "rpm -qi -f /usr/bin/mail" to find out. On Debian-based systems, try "dpkg -S /usr/bin/mail" to get the package name, and "dpkg -s <pkgname>" to get the details. From the error message you gave, I suspect it is mailx.
Have you tried with FORMAT=PLAIN?
You could try setting MAIL and MAILC to use nail or mutt rather than mailx, if you have them installed, something like this:
MAILC="/usr/bin/nail"
Some folks have had problems with mailx not liking carriage-return characters. Using nail should fix this, but this might also work:
MAILC="/usr/bin/tr -d '\\015' | mail"
J
On 23 May 2013 16:46, deepak deore <deepakdeore2004 at gmail.com> wrote:
Yes, all 3 recipients have the same problem. alert.log has "Null message body; hope that's ok" message. I am using win7 with outlook 2010, MTA is amazon SES.
On Thu, May 23, 2013 at 5:26 AM, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com> wrote:
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
Server OS is Ubuntu 12.04.2 LTS $ dpkg -S /usr/bin/mail dpkg-query: no path found matching pattern /usr/bin/mail.
This is a symlink so dpkg -S not showing the result. So checked the actual file which shows that mailutils owns this file. And MTA I am using is postfix.
$ ls -l /usr/bin/mail lrwxrwxrwx 1 root root 22 Jan 13 09:39 /usr/bin/mail -> /etc/alternatives/mail $ ls -l /etc/alternatives/mail lrwxrwxrwx 1 root root 23 Jan 13 09:39 /etc/alternatives/mail -> /usr/bin/mail.mailutils $ dpkg -S /usr/bin/mail.mailutils mailutils: /usr/bin/mail.mailutils
I am getting the RECOVERED mails properly but the SMS alerts on mobiles are blank which are in FORMAT=sms. I havent tried FORMAT=PLAIN, will give a try.
On Thu, May 23, 2013 at 1:19 PM, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
What's the OS that Xymon is running on?
What mail system runs on the Xymon server?
Xymon will probably execute the binary /usr/bin/mail. What is /usr/bin/mail? Is it mailx or mutt or something else? On RedHat/Fedora/Centos/SUSE you can type "rpm -qi -f /usr/bin/mail" to find out. On Debian-based systems, try "dpkg -S /usr/bin/mail" to get the package name, and "dpkg -s <pkgname>" to get the details. From the error message you gave, I suspect it is mailx.
Have you tried with FORMAT=PLAIN?
You could try setting MAIL and MAILC to use nail or mutt rather than mailx, if you have them installed, something like this:
MAILC="/usr/bin/nail"
Some folks have had problems with mailx not liking carriage-return characters. Using nail should fix this, but this might also work:
MAILC="/usr/bin/tr -d '\\015' | mail"
J
On 23 May 2013 16:46, deepak deore <deepakdeore2004 at gmail.com> wrote:
Yes, all 3 recipients have the same problem. alert.log has "Null message body; hope that's ok" message. I am using win7 with outlook 2010, MTA is amazon SES.
On Thu, May 23, 2013 at 5:26 AM, Jeremy Laidman <jlaidman at rebel-it.com.au
wrote:
On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com> wrote:
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
FORMAT=PLAIN is working, I am receiving the recovered messages on my mobile. But that message is way long since it is not in sms format.
could you tell where should i look?
On Thu, May 23, 2013 at 3:11 PM, deepak deore <deepakdeore2004 at gmail.com>wrote:
Server OS is Ubuntu 12.04.2 LTS $ dpkg -S /usr/bin/mail dpkg-query: no path found matching pattern /usr/bin/mail.
This is a symlink so dpkg -S not showing the result. So checked the actual file which shows that mailutils owns this file. And MTA I am using is postfix.
$ ls -l /usr/bin/mail lrwxrwxrwx 1 root root 22 Jan 13 09:39 /usr/bin/mail -> /etc/alternatives/mail $ ls -l /etc/alternatives/mail lrwxrwxrwx 1 root root 23 Jan 13 09:39 /etc/alternatives/mail -> /usr/bin/mail.mailutils $ dpkg -S /usr/bin/mail.mailutils mailutils: /usr/bin/mail.mailutils
I am getting the RECOVERED mails properly but the SMS alerts on mobiles are blank which are in FORMAT=sms. I havent tried FORMAT=PLAIN, will give a try.
On Thu, May 23, 2013 at 1:19 PM, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
What's the OS that Xymon is running on?
What mail system runs on the Xymon server?
Xymon will probably execute the binary /usr/bin/mail. What is /usr/bin/mail? Is it mailx or mutt or something else? On RedHat/Fedora/Centos/SUSE you can type "rpm -qi -f /usr/bin/mail" to find out. On Debian-based systems, try "dpkg -S /usr/bin/mail" to get the package name, and "dpkg -s <pkgname>" to get the details. From the error message you gave, I suspect it is mailx.
Have you tried with FORMAT=PLAIN?
You could try setting MAIL and MAILC to use nail or mutt rather than mailx, if you have them installed, something like this:
MAILC="/usr/bin/nail"
Some folks have had problems with mailx not liking carriage-return characters. Using nail should fix this, but this might also work:
MAILC="/usr/bin/tr -d '\\015' | mail"
J
On 23 May 2013 16:46, deepak deore <deepakdeore2004 at gmail.com> wrote:
Yes, all 3 recipients have the same problem. alert.log has "Null message body; hope that's ok" message. I am using win7 with outlook 2010, MTA is amazon SES.
On Thu, May 23, 2013 at 5:26 AM, Jeremy Laidman < jlaidman at rebel-it.com.au> wrote:
On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com> wrote:
HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
I was not aware that PLAIN and SMS were significantly different.
From: deepak deore [mailto:deepakdeore2004 at gmail.com] Sent: Saturday, May 25, 2013 06:46 AM To: Jeremy Laidman <jlaidman at rebel-it.com.au> Cc: xymon at xymon.com <xymon at xymon.com> Subject: Re: [Xymon] blank recovered sms alerts on mail
FORMAT=PLAIN is working, I am receiving the recovered messages on my mobile. But that message is way long since it is not in sms format.
could you tell where should i look?
On Thu, May 23, 2013 at 3:11 PM, deepak deore <deepakdeore2004 at gmail.com<mailto:deepakdeore2004 at gmail.com>> wrote: Server OS is Ubuntu 12.04.2 LTS $ dpkg -S /usr/bin/mail dpkg-query: no path found matching pattern /usr/bin/mail.
This is a symlink so dpkg -S not showing the result. So checked the actual file which shows that mailutils owns this file. And MTA I am using is postfix.
$ ls -l /usr/bin/mail lrwxrwxrwx 1 root root 22 Jan 13 09:39 /usr/bin/mail -> /etc/alternatives/mail $ ls -l /etc/alternatives/mail lrwxrwxrwx 1 root root 23 Jan 13 09:39 /etc/alternatives/mail -> /usr/bin/mail.mailutils $ dpkg -S /usr/bin/mail.mailutils mailutils: /usr/bin/mail.mailutils
I am getting the RECOVERED mails properly but the SMS alerts on mobiles are blank which are in FORMAT=sms. I havent tried FORMAT=PLAIN, will give a try.
On Thu, May 23, 2013 at 1:19 PM, Jeremy Laidman <jlaidman at rebel-it.com.au<mailto:jlaidman at rebel-it.com.au>> wrote: What's the OS that Xymon is running on?
What mail system runs on the Xymon server?
Xymon will probably execute the binary /usr/bin/mail. What is /usr/bin/mail? Is it mailx or mutt or something else? On RedHat/Fedora/Centos/SUSE you can type "rpm -qi -f /usr/bin/mail" to find out. On Debian-based systems, try "dpkg -S /usr/bin/mail" to get the package name, and "dpkg -s <pkgname>" to get the details. From the error message you gave, I suspect it is mailx.
Have you tried with FORMAT=PLAIN?
You could try setting MAIL and MAILC to use nail or mutt rather than mailx, if you have them installed, something like this:
MAILC="/usr/bin/nail"
Some folks have had problems with mailx not liking carriage-return characters. Using nail should fix this, but this might also work:
MAILC="/usr/bin/tr -d '\\015' | mail"
J
On 23 May 2013 16:46, deepak deore <deepakdeore2004 at gmail.com<mailto:deepakdeore2004 at gmail.com>> wrote: Yes, all 3 recipients have the same problem. alert.log has "Null message body; hope that's ok" message. I am using win7 with outlook 2010, MTA is amazon SES.
On Thu, May 23, 2013 at 5:26 AM, Jeremy Laidman <jlaidman at rebel-it.com.au<mailto:jlaidman at rebel-it.com.au>> wrote: On 21 May 2013 22:06, deepak deore <deepakdeore2004 at gmail.com<mailto:deepakdeore2004 at gmail.com>> wrote: HOST=$PRD SERVICE=* EXSERVICE=disk MAIL $ADMIN color=red,yellow REPEAT=20 RECOVERED NOTICE format=sms MAIL $MANAGER color=red,yellow DURATION>20 REPEAT=20 RECOVERED NOTICE format=sms MAIL mail at example.com<mailto:mail at example.com> color=red,yellow REPEAT=60 RECOVERED NOTICE
Are all 3 recipients having the same problem?
Are there any interesting messages in the alert.log file?
What OS are you using, and what mail client and MTA?
J
On 05/25/13 06:46, deepak deore wrote:
FORMAT=PLAIN is working, I am receiving the recovered messages on my mobile. But that message is way long since it is not in sms format.
could you tell where should i look?
deepak, I think I may have run into a similar issue a long time ago, or maybe my issue was that I didn't like the level, or type of detail in the SMS format (i forget now), so I wrote a script to take the PLAIN format and TXT it to me via the AT&T email-to-SMS gateway. The benefit of this is that you have complete control to manipulate the format and contents of the SMS that gets sent.
Here's what I did:
First, in alerts.cfg
Define recipient variables
--------------------------
$waaphone=##########
Define scripts
--------------
$xymon-email-alert=/usr/local/sbin/xymon-email-alert.sh $xymon-sms-alert=/usr/local/sbin/xymon-SMS-alert.sh
Define Times
------------
$ninetofive=W:0900:1700 $afterhours=W:1701:0859 $weekends=60:0000:2359 $smsalerthours=W:0730:2359,60:0900:2200 $never=365d
Define Alerts
-------------
Match ALL FIREWALLS
-------------------
PAGE=revpol/client_firewalls SCRIPT $xymon-sms-alert $waaphone TIME=$smsalerthours DURATION>5m / FORMAT=SMS REPEAT=$neverCOLOR=yellow,red RECOVERED
Then my SMS alert script (/usr/local/sbin/xymon-SMS-alert.sh) follows. It could probably use some improvement, been a while since I worked with it. :) (this may wrap poorly in email)
--[snip]-- #!/bin/bash
waa - 20100209
---------------
date=date +%Y%m%d-%H:%M:%S
log="/tmp/xymon-SMS.log"
FROM="From: RP Xymon <someone at example.com>"
TO="To: $RCPT"
First, determine if this is a NOTICE message
(eg: disabling or enabling a test)
--------------------------------------------
NOTICE=echo "$BBALPHAMSG" | grep " INFO"
if [ ! -z "$NOTICE" ]; then
This is an INFO type report, so get the event
(what was enabled/disabled) and the reason
---------------------------------------------
EVENT=echo "$BBALPHAMSG" | grep "Monitoring of"
REASON=echo "$BBALPHAMSG" | grep "Reason:" | cut -d':' -f2-
if [ -z "$REASON" ]; then
MSG="$EVENT"
else
MSG="$EVENT:$REASON"
fi
else # This was not an INFO type report so create # and format the normal SMS message # ------------------------------------------
# Determine if this is a recovery notice for a test
# -------------------------------------------------
if [ "$RECOVERED" = "1" ]; then
RECOVERED=" (Recovered)"
else
RECOVERED=""
fi
# Uppercase the service name
# --------------------------
UPSVCNAME=`echo $BBSVCNAME | tr [:lower:] [:upper:]`
# Set the message text
# --------------------
MSG="$RECOVERED ($BBCOLORLEVEL) $UPSVCNAME on $BBHOSTNAME\nDown for
$DOWNSECS seconds" fi
EMAIL="$FROM\n$TO\n\n$MSG"
Send the email to the email-to-SMS gateway
------------------------------------------
echo -e "$EMAIL" | /usr/sbin/sendmail -t --[snip]--
Hope this helps.
-- Bill Arlofski Reverse Polarity, LLC http://www.revpol.com/ --not responsible for anything below this line--
Bill, thanks a lot for the code. I made few changes in this code as per my requirement and mail command was not working with this. Also Recovered BBCOLORLEVEL was always red. So made that change as well. Here is my script here if anyone else needs this.
#!/bin/bash
TO="$RCPT"
NOTICE=echo "$BBALPHAMSG" | grep " INFO"
if [ ! -z "$NOTICE" ]; then
EVENT=echo "$BBALPHAMSG" | grep "Monitoring of"
REASON=echo "$BBALPHAMSG" | grep "Reason:" | cut -d':' -f2-
if [ -z "$REASON" ]; then
MSG="$EVENT"
else
MSG="$EVENT:$REASON"
fi
else
if [ "$RECOVERED" = "1" ]; then
RECOVERED=" (Recovered)"
BBCOLORLEVEL="green"
else
RECOVERED=""
fi
UPSVCNAME=echo $BBSVCNAME | tr [:lower:] [:upper:]
MSG="$RECOVERED ($BBCOLORLEVEL) $UPSVCNAME on $BBHOSTNAME:\n
Problem for $DOWNSECS seconds"
fi
EMAIL="$TO\n\n$MSG"
echo -e "$EMAIL" | /usr/bin/mail -t
On Sat, May 25, 2013 at 9:17 PM, Bill Arlofski <waa-hobbitml at revpol.com>wrote:
On 05/25/13 06:46, deepak deore wrote:
FORMAT=PLAIN is working, I am receiving the recovered messages on my mobile. But that message is way long since it is not in sms format.
could you tell where should i look?
deepak, I think I may have run into a similar issue a long time ago, or maybe my issue was that I didn't like the level, or type of detail in the SMS format (i forget now), so I wrote a script to take the PLAIN format and TXT it to me via the AT&T email-to-SMS gateway. The benefit of this is that you have complete control to manipulate the format and contents of the SMS that gets sent.
Here's what I did:
First, in alerts.cfg
Define recipient variables
--------------------------
$waaphone=##########
Define scripts
--------------
$xymon-email-alert=/usr/local/sbin/xymon-email-alert.sh $xymon-sms-alert=/usr/local/sbin/xymon-SMS-alert.sh
Define Times
------------
$ninetofive=W:0900:1700 $afterhours=W:1701:0859 $weekends=60:0000:2359 $smsalerthours=W:0730:2359,60:0900:2200 $never=365d
Define Alerts
-------------
Match ALL FIREWALLS
-------------------
PAGE=revpol/client_firewalls SCRIPT $xymon-sms-alert $waaphone TIME=$smsalerthours DURATION>5m / FORMAT=SMS REPEAT=$neverCOLOR=yellow,red RECOVERED
Then my SMS alert script (/usr/local/sbin/xymon-SMS-alert.sh) follows. It could probably use some improvement, been a while since I worked with it. :) (this may wrap poorly in email)
--[snip]-- #!/bin/bash
waa - 20100209
---------------
date=
date +%Y%m%d-%H:%M:%Slog="/tmp/xymon-SMS.log" FROM="From: RP Xymon <someone at example.com>" TO="To: $RCPT"First, determine if this is a NOTICE message
(eg: disabling or enabling a test)
--------------------------------------------
NOTICE=
echo "$BBALPHAMSG" | grep " INFO"if [ ! -z "$NOTICE" ]; thenThis is an INFO type report, so get the event
(what was enabled/disabled) and the reason
---------------------------------------------
EVENT=
echo "$BBALPHAMSG" | grep "Monitoring of"REASON=echo "$BBALPHAMSG" | grep "Reason:" | cut -d':' -f2-if [ -z "$REASON" ]; then MSG="$EVENT" else MSG="$EVENT:$REASON" fielse # This was not an INFO type report so create # and format the normal SMS message # ------------------------------------------
# Determine if this is a recovery notice for a test # ------------------------------------------------- if [ "$RECOVERED" = "1" ]; then RECOVERED=" (Recovered)" else RECOVERED="" fi # Uppercase the service name # -------------------------- UPSVCNAME=`echo $BBSVCNAME | tr [:lower:] [:upper:]` # Set the message text # -------------------- MSG="$RECOVERED ($BBCOLORLEVEL) $UPSVCNAME on $BBHOSTNAME\nDown for$DOWNSECS seconds" fi
EMAIL="$FROM\n$TO\n\n$MSG"
Send the email to the email-to-SMS gateway
------------------------------------------
echo -e "$EMAIL" | /usr/sbin/sendmail -t --[snip]--
Hope this helps.
-- Bill Arlofski Reverse Polarity, LLC http://www.revpol.com/ --not responsible for anything below this line--
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
participants (4)
-
deepakdeore2004@gmail.com
-
jlaidman@rebel-it.com.au
-
novosirj@umdnj.edu
-
waa-hobbitml@revpol.com