[Xymon] Sending email alerts for xymon

Tim McCloskey tm at freedom.com
Wed Jul 25 23:47:57 CEST 2012


________________________________________
From: xymon-bounces at xymon.com [xymon-bounces at xymon.com] On Behalf Of Henrik Størner [henrik at hswn.dk]
Sent: Wednesday, July 25, 2012 2:29 PM
To: xymon at xymon.com
Subject: Re: [Xymon] Sending email alerts for xymon

On 25-07-2012 23:19, Raghuv adhepalli wrote:
> Hello,
>
> I am trying to use the xymon alert system to send emails.
>
> When I use "MAIL", I am able to receive the mails as they were intended.
> HOST=* SERVICE=* COLOR=yellow
>          MAIL alert at xymon.com
>
> But, the problem occurs when I start using the "SCRIPT". The mails
> aren't being forwarded
>
> HOST=* SERVICE=* COLOR=yellow
>          SCRIPT test.sh alert at xymon.com
>
> I understand that the "SCRIPT" uses two arguments, the script name and
> the recipient name.
>
> Here's how my script looks like,
>
> *****************************************************************
> #!bin/bash
>
> mail -s "$BBALPHAMSG $BBHOSTNAME $MACHIP $BBSVCNAME $RECOVERED" $RCPT
>
> *****************************************************************

I don't really understand why you are not using MAIL in alerts.cfg then.

> Can anyone please explain to me a bit more on how the alert system works
> when the "SCRIPT" is used?

Check the alert.log logfile, it should log whatever error-message the
alert-script generates (if any). I suspect that your "mail" utility
drops messages with no message body.

So I wouldn't put $BBALPHAMSG in the subject of a mail. Better to put it
into the mail body, e.g.

echo "$BBALPHSMSG" | mail -s "$BBHOSTNAME $MACHIP $BBSVCNAME $RECOVERED"
$RCPT


Regards,
Henrik
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon

Here is another example.  I have some old rules that are used to send simple alerts without the fluff.  Then, I have some rules for folks that like all of the $BBvars.  What I did for a simple alert follows.  I know there are other ways but this works fine for me.  In the info screen the recipient will show up as the name 'web-mail-prim' in this example.  So, really the recipient is not coming out of the alert config, it's from the shell script which is in turn controlled by another widget in cron.

(alerts)
PAGE=%^somepage/(linux|solaris) EXSERVICE=conn COLOR=red DURATION>6m 
SCRIPT $alertdir/morepathinfo/mail-primary.sh mail-web-prim FORMAT=sms  REPEAT=1h


(mail-primary.sh)
#!/bin/bash

/bin/mail -s "$BBHOSTSVC" foo at domain.tld < /dev/null














More information about the Xymon mailing list