<div dir="ltr">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.<div>

<br></div><div>----------------------------------------------------------------------------------------------------------<br></div><div><div>#!/bin/bash</div><div><br></div><div>TO="$RCPT"</div><div><br></div><div>

NOTICE=`echo "$BBALPHAMSG" | grep " INFO"`</div><div>if [ ! -z "$NOTICE" ]; then</div><div>        EVENT=`echo "$BBALPHAMSG" | grep "Monitoring of"`</div><div>        REASON=`echo "$BBALPHAMSG" | grep "Reason:" | cut -d':' -f2-`</div>

<div>        if [ -z "$REASON" ]; then</div><div>                MSG="$EVENT"</div><div>        else</div><div>                MSG="$EVENT:$REASON"</div><div>        fi</div><div>else</div><div>

        if [ "$RECOVERED" = "1" ]; then</div><div>                RECOVERED=" (Recovered)"</div><div>                BBCOLORLEVEL="green"</div><div>        else</div><div>                RECOVERED=""</div>

<div>        fi</div><div>        UPSVCNAME=`echo $BBSVCNAME | tr [:lower:] [:upper:]`</div><div>        MSG="$RECOVERED ($BBCOLORLEVEL) $UPSVCNAME on $BBHOSTNAME:\n Problem for $DOWNSECS seconds"</div><div>fi</div>

<div><br></div><div>EMAIL="$TO\n\n$MSG"</div><div><br></div><div>echo -e "$EMAIL" | /usr/bin/mail -t</div></div><div>----------------------------------------------------------------------------------------------------------</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, May 25, 2013 at 9:17 PM, Bill Arlofski <span dir="ltr"><<a href="mailto:waa-hobbitml@revpol.com" target="_blank">waa-hobbitml@revpol.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05/25/13 06:46, deepak deore wrote:<br>
> FORMAT=PLAIN is working, I am receiving the recovered messages on my mobile.<br>
> But that message is way long since it is not in sms format.<br>
><br>
> could you tell where should i look?<br>
<br>
</div>deepak, I think I may have run into a similar issue a long time ago, or maybe<br>
my issue was that I didn't like the level, or type of detail in the SMS format<br>
(i forget now), so I wrote a script to take the PLAIN format and TXT it to me<br>
via the AT&T email-to-SMS gateway. The benefit of this is that you have<br>
complete control to manipulate the format and contents of the SMS that gets sent.<br>
<br>
<br>
Here's what I did:<br>
<br>
<br>
First, in alerts.cfg<br>
<br>
# Define recipient variables<br>
# --------------------------<br>
$waaphone=##########<br>
<br>
# Define scripts<br>
# --------------<br>
$xymon-email-alert=/usr/local/sbin/xymon-email-alert.sh<br>
$xymon-sms-alert=/usr/local/sbin/xymon-SMS-alert.sh<br>
<br>
# Define Times<br>
# ------------<br>
$ninetofive=W:0900:1700<br>
$afterhours=W:1701:0859<br>
$weekends=60:0000:2359<br>
$smsalerthours=W:0730:2359,60:0900:2200<br>
$never=365d<br>
<br>
# Define Alerts<br>
# -------------<br>
# Match ALL FIREWALLS<br>
# -------------------<br>
PAGE=revpol/client_firewalls<br>
  SCRIPT $xymon-sms-alert $waaphone TIME=$smsalerthours DURATION>5m /<br>
  FORMAT=SMS REPEAT=$neverCOLOR=yellow,red RECOVERED<br>
<br>
<br>
<br>
Then my SMS alert script (/usr/local/sbin/xymon-SMS-alert.sh) follows. It<br>
could probably use some improvement, been a while since I worked with it. :)<br>
(this may wrap poorly in email)<br>
<br>
--[snip]--<br>
#!/bin/bash<br>
#<br>
# waa - 20100209<br>
# ---------------<br>
date=`date +%Y%m%d-%H:%M:%S`<br>
log="/tmp/xymon-SMS.log"<br>
FROM="From: RP Xymon <<a href="mailto:someone@example.com">someone@example.com</a>>"<br>
TO="To: $RCPT"<br>
<br>
# First, determine if this is a NOTICE message<br>
# (eg: disabling or enabling a test)<br>
# --------------------------------------------<br>
NOTICE=`echo "$BBALPHAMSG" | grep " INFO"`<br>
if [ ! -z "$NOTICE" ]; then<br>
<br>
  # This is an INFO type report, so get the event<br>
  # (what was enabled/disabled) and the reason<br>
  # ---------------------------------------------<br>
  EVENT=`echo "$BBALPHAMSG" | grep "Monitoring of"`<br>
  REASON=`echo "$BBALPHAMSG" | grep "Reason:" | cut -d':' -f2-`<br>
  if [ -z "$REASON" ]; then<br>
    MSG="$EVENT"<br>
    else<br>
      MSG="$EVENT:$REASON"<br>
  fi<br>
<br>
  else<br>
    # This was not an INFO type report so create<br>
    # and format the normal SMS message<br>
    # ------------------------------------------<br>
<br>
    # Determine if this is a recovery notice for a test<br>
    # -------------------------------------------------<br>
    if [ "$RECOVERED" = "1" ]; then<br>
      RECOVERED=" (Recovered)"<br>
      else<br>
        RECOVERED=""<br>
    fi<br>
<br>
    # Uppercase the service name<br>
    # --------------------------<br>
    UPSVCNAME=`echo $BBSVCNAME | tr [:lower:] [:upper:]`<br>
<br>
    # Set the message text<br>
    # --------------------<br>
    MSG="$RECOVERED ($BBCOLORLEVEL) $UPSVCNAME on $BBHOSTNAME\nDown for<br>
$DOWNSECS seconds"<br>
fi<br>
<br>
EMAIL="$FROM\n$TO\n\n$MSG"<br>
<br>
# Send the email to the email-to-SMS gateway<br>
# ------------------------------------------<br>
echo -e "$EMAIL" | /usr/sbin/sendmail -t<br>
--[snip]--<br>
<br>
<br>
Hope this helps.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Bill Arlofski<br>
Reverse Polarity, LLC<br>
<a href="http://www.revpol.com/" target="_blank">http://www.revpol.com/</a><br>
--not responsible for anything below this line--<br>
_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</font></span></blockquote></div><br></div>