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 user-d0a7de99275f@xymon.invalid <mailto:user-d0a7de99275f@xymon.invalid> 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 at xymon.com<