Carsten,

  I'm having the same issues. 'exec' seems to only work with the 'if
failed' command.  With some creative thinking, I came up with the following
config for use with heartbeat (linux-ha).  I'm still in the process of
testing, but this will give you an idea:

check process apache
       with pidfile /var/run/httpd.pid
       start program = "/etc/init.d/httpd start"
       stop program  = "/etc/init.d/httpd stop"
       if failed host 192.168.1.25 port 80 for 3 times within 5 cycles then
exec "/usr/lib/heartbeat/hb_standby"
       if failed host 192.168.1.26 port 80 for 3 times within 5 cycles then
exec "/usr/lib/heartbeat/hb_standby"
   mode manual
group node1


The above is for apache on 2 ip's with heartbeat/ipfail managing them.
Originally I had the checks seperate with 'depends on' and mode active, but
monit seems to ignore 'depends on' in that case.  I consider that a bug,
since it's counter-intuitive.. you would think that a check that depends on
a manual check that is currently off would ignore that check..  anyway..
hope this helps!

-Alex

On 1/4/07, markmann <[EMAIL PROTECTED]> wrote:

Hi,

I am refering to an articel in the mail archive
(http://www.mail-archive.com/[email protected]/msg00803.html).
It is about the chance to do an "exec" after a specified number of
restarts of a process.
The problem is, that in this particular case the responsible statement
won't work with "exec".
Only "timeout" is accepted.

Martin wrote a hint for fixing the problem in an other way.
But...
:-) that fix is not for me.

I do something like that in monitrc file:

...
check process apache2 with pidfile /var/run/apache2.pid
group www-data
start program = "/etc/init.d/apache2 start"
stop  program = "/etc/init.d/apache2 stop"

if cpu > 60 % for 2 cycles then alert
if cpu > 80 % for 5 cycles then restart
if children > 250 then restart
if failed host mywebhost.uni-wuppertal.de port 443 type tcpssl protocol
http request "/mymonit.html" then restart

...

Now, I would like to write something like this:

if 3 restarts within 5 cycles then exec "/etc/monit/shutmedown.sh"

In either case the exec has to be done, because the systemload and / or
the heavy number of children indicates an attack (max systemload in
normal production on the server is lower 50 %) and we can't do anything
against it - or there went something wrong with apache2 and we want to
know the system down.

With "exec" I want to start a shutdown-script by my own.
After that, the servermirror will notice the absence of the
productionsystem (signaled by heartbeat) and starts up apache2 and some
other services.


How can I make that work?


Carsten



--------------------------------------------
Bergische Universitaet Wuppertal
Dezernat 2.3
Gaussstr.20
D-42097 Wuppertal (Germany)
--------------------------------------------
phone: +49 202 439-3804
fax:   +49 202 439-2916
email: [EMAIL PROTECTED]
--------------------------------------------


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to