2

I have:

  1. Tomcat with webapp deployed via mvn tomcat:redeploy.
  2. Monit, pinging the host and restarting server if ping failed.

The thing is there in a moment during the redeployment when ping will fail - and this is normal, actually.

So, the question is - what is the best way to teach monit to consider the fact of redeployment and not to confuse it with "real" black outs.

This is of course an issue of balance between elegance, ease of implementation and scalability. The most straightforward solution I can think of - is just to shutdown monit before deployment and start it up after once again. But this if far from elegance I guess.

shabunc
  • 87
  • 1
  • 2
  • 12
  • Why would a ping fail during (hot?) deployment? The only reason I see is when your machine and/or network is starved of resources, and ICMP packets are dropped because of that, which isn't exactly normal. – pyroscope Apr 11 '12 at 05:36

1 Answers1

4

The trick is to tell monit to 'unmonitor' the target while it's down. the monit binary uses the built-in http server for these actions. Note that the httpd is not brought up until the (eventual) "delay" time has passed.

In monitrc:

 set httpd port 2812 and use the address localhost
    allow localhost

You can check the status of your check:

monit status <check_name>

Unmonitor with:

monit unmonitor <check_name>

Monitor again with:

monit monitor <check_name>
3molo
  • 4,340
  • 5
  • 30
  • 46