monit-general
[Top][All Lists]
Advanced

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

[monit] Ideas for monitoring a web site under maintenance?


From: Christopher Opena
Subject: [monit] Ideas for monitoring a web site under maintenance?
Date: Thu, 12 Mar 2009 21:51:42 -0700

Hello all, just wondering if anyone has any ideas on a good way to monitor a site that should be considered "up" while undergoing maintenance, but if it's been undergoing maintenance too long (say, 2 hours), then monit should alert.

Right now, I'm monitoring the site like so:

check host app_login_page with address localhost
   if failed url
      https://app_login_url
      and content == "login|maintenance"
      timeout 30 seconds
      for 1 cycles
      then alert
   group app

This works quite nicely for determining if the site is up or not.  However, I'm rather stumped on how to approach a secondary test for the maintenance state exceeding 2 hours.  The first thing I tried was to put a clause under 'else if succeeded', like so:

  else if succeeded
      and content == "maintenance"
      for 120 cycles
      then alert
  group app

But of course that's wrong since the pattern matching has to match the failed situation.

Next I tried to match against a file, because in order to trigger a maintenance situation, a maintenance.html file is uploaded to a specific directory.  I tried:

check file app_maint with path /path/to/maintenance.html
   if timestamp > 2 hours then exec "/bin/rm -f /path/to/maintenance.html"
 group app

That works great if the maintenance page is up, but of course once I take it out of maintenance mode and get the normal login page I get alerts from this check for failing to find the file at the designated path.  As you can see, the way to get out of maintenance mode is to remove the maintenance.html file.

Ideally, I would love to use the file check coupled with some action that *doesn't* alert.  But according to the manual (http://mmonit.com/monit/documentation/monit.html#service_tests) every action you can take [Alert | Restart | Start | Stop | Exec | Monitor | Unmonitor] sends an alert.

If anyone has any experience or ideas for this type of situation, I'd dearly appreciate any help.

Cheers,
-Chris.



reply via email to

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