[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A way to invoke multiple actions...

From: Jason L. Buberel
Subject: A way to invoke multiple actions...
Date: Sun, 31 Dec 2006 21:26:08 -0800
User-agent: Thunderbird (X11/20061115)

First, just wanted to say 'great job' to the monit developers. I've now got it deployed on all of the servers behind 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 (

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/
       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/ on"
       depends on postgres

And in a perfect world, I would love to be able to have monit automatically invoke the reversal script (' 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 "" when service foobar is monitored' -or- 'exec "" when service apache is timedout').

Many thanks for any suggestions,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]