First, just wanted to say 'great job' to the monit developers. I've now
got it deployed on all of the servers behind
http://www.altosresearch.com/ and it has been doing a great job.
As I discover more and more services I would like monit to take care of
for me, I ran into the following scenario that I'm not sure how to
configure:
1. I have an apache -> tomcat -> postgres dependency chain defined and
working nicely.
2. I have a script available that will switch apache into 'maintenance
mode' which I use when the site is down for maintenance. It simply
redirects all requests to a single static maintenance display
(http://www.altosresearch.com/maintenance/index.html).
What I would like to have happen is that when the 'tomcat' process is
timed-out by monit (the max # of restart attempts is exceeded) that an
alert is sent AND a script is executed:
check process tomcat with pidfile /opt/tomcat/temp/tomcat.pid
alert address@hidden on { timeout }
start program = "/etc/init.d/tomcat start"
stop program = "/etc/init.d/tomcat stop"
if 5 restarts within 5 cycles
then timeout
if 5 restarts within 5 cycles
then exec "/usr/local/bin/maintenance-mode.sh on"
depends on postgres
And in a perfect world, I would love to be able to have monit
automatically invoke the reversal script ('maintenance-mode.sh off')
when tomcat recovers (becomes monitored again).
Are either of my two configuration scenarios possible? Essentially what
I am looking to do is have monit execute one or more scripts based on a
state change to a monitored service ('exec "some-script.sh" when service
foobar is monitored' -or- 'exec "some-script.sh" when service apache is
timedout').
Many thanks for any suggestions,
jason
------------------------------------------------------------------------
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general