[xymon] Is setting high importance on alert emails possible?

Ralph Mitchell ralphmitchell at gmail.com
Thu Dec 23 03:53:08 CET 2010


OK, going out on a limb here (I've never used paging...) maybe BBCOLORLEVEL
is "red" because that's the color the service just recovered FROM??  The
xymon-alerts man page includes this line in the list of enviroment variables
passed to the script:

     RECOVERED Is "1" if the service has recovered.

So, the script would become:


#!/bin/bash

if [ "$RECOVERED" -eq 1 ]; then
  STATUS="RECOVERED"
else
  case $BBCOLORLEVEL in
    red)
      STATUS="CRITICAL"
      ;;
    yellow)
      STATUS="WARNING"
      ;;
    purple)
      STATUS="stopped reporting"
      ;;
    *)
      STATUS="unknown status"
      ;;
  esac
fi

MESSAGE="To: $RCPT
Subject: $BBHOSTNAME $STATUS
Content-Type: text/plain
X-Priority: 1 (Highest)
X-MSMail-Priority: High

$BBALPHAMSG"

echo "$MESSAGE" | sendmail -t
exit 0



You might even want to consider changing the Subject line to include the
service name:

     Subject: $BBHOSTNAME $BBSVCNAME $STATUS

Ralph Mitchell


On Wed, Dec 22, 2010 at 10:24 AM, Nordquist, Daniel <
Daniel.Nordquist at orlandohealth.com> wrote:

>  Can anyone tell me why this does not change the status on a “recovered”
> email?  It sends the recovered email and says the test is OK (up), but does
> not change the subject line.
>
>
>
>
>
> #!/bin/bash
>
>
>
> case $BBCOLORLEVEL in
>
> *  green)*
>
> *    STATUS="RECOVERED"*
>
> *    ;;*
>
>   red)
>
>     STATUS="CRITICAL"
>
>     ;;
>
>   yellow)
>
>     STATUS="WARNING"
>
>     ;;
>
>   purple)
>
>     STATUS="stopped reporting"
>
>     ;;
>
>   *)
>
>     STATUS="unknown status"
>
>     ;;
>
> esac
>
>
>
> MESSAGE="To: $RCPT
>
> Subject: $BBHOSTNAME $STATUS
>
> Content-Type: text/plain
>
> X-Priority: 1 (Highest)
>
> X-MSMail-Priority: High
>
>
>
> $BBALPHAMSG"
>
>
>
> echo "$MESSAGE" | sendmail -t
>
> exit 0
>
>
>
>
>
>
>
> *From:* Ralph Mitchell [mailto:ralphmitchell at gmail.com]
> *Sent:* Tuesday, December 21, 2010 3:49 PM
>
> *To:* xymon at xymon.com
> *Subject:* Re: [xymon] Is setting high importance on alert emails
> possible?
>
>
>
> I haven't tested it, but something like this ought to do it:
>
>
>
> #!/bin/bash
>
>
>
> case $BBCOLORLEVEL in
>
>   red)
>
>     STATUS="CRITICAL"
>
>     ;;
>
>   yellow)
>
>     STATUS="WARNING"
>
>     ;;
>
>   purple)
>
>     STATUS="stopped reporting"
>
>     ;;
>
>   *)
>
>     STATUS="unknown status"
>
>     ;;
>
> esac
>
>
>
> MESSAGE="To: $RCPT
>
> Subject: $BBHOSTNAME $STATUS
>
> Content-Type: text/plain
>
> X-Priority: 1 (Highest)
>
> X-MSMail-Priority: High
>
>
>
> $BBALPHAMSG"
>
>
>
> echo "$MESSAGE" | sendmail -t
>
> exit 0
>
>
>
>
>
> Ralph Mitchell
>
>
>
>
>
> On Tue, Dec 21, 2010 at 12:43 PM, Nordquist, Daniel <
> Daniel.Nordquist at orlandohealth.com> wrote:
>
> Thank you!
>
>
>
> I’m a noob at this so I’m not familiar with how to format a script.  Can
> you point me to a good page where I can see some examples?
>
>
>
>
>
> *From:* Ralph Mitchell [mailto:ralphmitchell at gmail.com]
> *Sent:* Tuesday, December 21, 2010 11:46 AM
> *To:* xymon at xymon.com
> *Subject:* Re: [xymon] Is setting high importance on alert emails
> possible?
>
>
>
> There's an email header that needs to be inserted.  Here's an example:
>
>
>
>    http://techonthenet.com/unix/high_priority.php
>
>
>
> You'll need to change your alert config to use SCRIPT instead of MAIL, then
> write a script to pick up the relevant info from the environment variables
> listed in the xymon-alerts help page.  You don't need to write everything to
> a file, just use a big echo statement and pipe it through sendmail.  The
> blank line between the headers and the message body is important...
>
>
>
> Ralph Mitchell
>
>
>
> On Tue, Dec 21, 2010 at 10:15 AM, Josh Luthman <
> josh at imaginenetworksllc.com> wrote:
>
> I think if it's available with the command Henrik made it would have
> been documented.  If not documented, I'd count on it not existing.
>
> What you'll probably need to do is call upon your own script to send
> the email and you can change that with whatever mail command you use.
>
> Josh Luthman
> Office: 937-552-2340
> Direct: 937-552-2343
> 1100 Wayne St
> Suite 1337
> Troy, OH 45373
>
>
>
>
> On Tue, Dec 21, 2010 at 10:11 AM, Nordquist, Daniel
> <Daniel.Nordquist at orlandohealth.com> wrote:
> > Hey all, I doubt I can do this but maybe someone knows a trick…
> >
> >
> >
> > I’d like to be able to send email alerts with a high importance flag
> based
> > on the alert color and/or specific server or service that is down.
> >
> >
> >
> > Is there any way to do this?  I’ve scoured the man pages but can’t find
> > anything.
> >
> >
> >
> > Thanks,
> >
> > Dan
> >
> >
> >
> > ________________________________
> > This e-mail message and any attached files are confidential and are
> intended
> > solely for the use of the addressee(s) named above. If you are not the
> > intended recipient, any review, use, or distribution of this e-mail
> message
> > and any attached files is strictly prohibited.
> >
> > This communication may contain material protected by Federal privacy
> > regulations, attorney-client work product, or other privileges. If you
> have
> > received this confidential communication in error, please notify the
> sender
> > immediately by reply e-mail message and permanently delete the original
> > message. To reply to our email administrator directly, send an email to:
> > postmaster at orlandohealth.com .
> >
> > If this e-mail message concerns a contract matter, be advised that no
> > employee or agent is authorized to conclude any binding agreement on
> behalf
> > of Orlando Health by e-mail without express written confirmation by an
> > officer of the corporation. Any views or opinions presented in this
> e-mail
> > are solely those of the author and do not necessarily represent those of
> > Orlando Health.
> >
>
> To unsubscribe from the xymon list, send an e-mail to
> xymon-unsubscribe at xymon.com
>
>
>
>
>  ------------------------------
>
> This e-mail message and any attached files are confidential and are
> intended solely for the use of the addressee(s) named above. If you are not
> the intended recipient, any review, use, or distribution of this e-mail
> message and any attached files is strictly prohibited.
>
> This communication may contain material protected by Federal privacy
> regulations, attorney-client work product, or other privileges. If you have
> received this confidential communication in error, please notify the sender
> immediately by reply e-mail message and permanently delete the original
> message. To reply to our email administrator directly, send an email to:
> postmaster at orlandohealth.com .
>
> If this e-mail message concerns a contract matter, be advised that no
> employee or agent is authorized to conclude any binding agreement on behalf
> of Orlando Health by e-mail without express written confirmation by an
> officer of the corporation. Any views or opinions presented in this e-mail
> are solely those of the author and do not necessarily represent those of
> Orlando Health.
>
>
>
> ------------------------------
> This e-mail message and any attached files are confidential and are
> intended solely for the use of the addressee(s) named above. If you are not
> the intended recipient, any review, use, or distribution of this e-mail
> message and any attached files is strictly prohibited.
>
> This communication may contain material protected by Federal privacy
> regulations, attorney-client work product, or other privileges. If you have
> received this confidential communication in error, please notify the sender
> immediately by reply e-mail message and permanently delete the original
> message. To reply to our email administrator directly, send an email to:
> postmaster at orlandohealth.com .
>
> If this e-mail message concerns a contract matter, be advised that no
> employee or agent is authorized to conclude any binding agreement on behalf
> of Orlando Health by e-mail without express written confirmation by an
> officer of the corporation. Any views or opinions presented in this e-mail
> are solely those of the author and do not necessarily represent those of
> Orlando Health.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20101222/a1b4218b/attachment.html>


More information about the Xymon mailing list