[Xymon] XYMON - corrective measures?

Tom S tsztur at gmail.com
Fri Dec 23 23:17:35 CET 2011


Thanks Henrik,

So this should do it?
HOST=www.foo.com <http://www.foo.com> SERVICE=http
MAIL cio at foo.com <mailto:cio at foo.com> DURATION>2 COLOR=red
SCRIPT /usr/local/bin/restartapache.sh 123456789 REPEAT 1440

That above will email cio at foo.com after 2 minutes of RED
It will also call up /usr/local/bin/restartapache.sh and run it once every
24 hours if it's down that long?

Do I need to put in a DURATION on that one also or does it keep the 2
minutes from the above line or does it run it as soon as it see's it's
red?  Can I put a DURATION on that also? (eg. SCRIPT
/usr/local/bin/restartapache.sh 123456789 REPEAT 1440 DURATION>2 )

thanks!!

>


On Fri, Dec 23, 2011 at 5:05 PM, Henrik Størner <henrik at hswn.dk> wrote:

> On 23-12-2011 22:57, Tom S wrote:
>
>> Thanks.
>>
>> So this will work?: (example in alerts.cfg)
>> HOST=www.foo.com <http://www.foo.com> SERVICE=http
>> MAIL cio at foo.com <mailto:cio at foo.com> DURATION>2 COLOR=red
>> SCRIPT /usr/local/bin/restartapache.**sh
>>
>
> Check the alerts.cfg man-page, you need a "recipient" on the SCRIPT
> command - if you don't use it, just put dummy text after the command.
>
>
>  and in restartapache.sh I would have the following:
>> #/bin/bash
>> ssh xymon at web1-server 'sudo /etc/init.d/apache2 restart'
>> exit
>> (considering xymon is in the sudoers list)
>>
>> How can I make sure that the 'SCRIPT /usr/local/bin/restartapache.**sh'
>> is
>> only run once per alert in case of network issues (connecting to port
>> 80) it doesn't keep trying to ssh and restarting the server every few
>> minutes?
>>
>
> Use REPEAT to limit it to e.g. once every 24 hours. Note that the
> repeat-setting gets reset once the alert clears, so it will work OK even if
> the server goes down at 10 AM, comes back up, and then goes down again at 7
> PM; in both cases the script will be called.
>
>
> Regards,
> Henrik
>
> ______________________________**_________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/**mailman/listinfo/xymon<http://lists.xymon.com/mailman/listinfo/xymon>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20111223/bf645a54/attachment.html>


More information about the Xymon mailing list