Support disabling checks when file is present

Issue #145 closed
Kieran Pilkington created an issue

Use case: Deploying applications that need processes to stop before deploying means that monit will restart those processes before the deploy is finished, requiring a restart to those processes manually

Proposed enhancement: Allow disabling checks by checking for different conditions. In this case, something like (not the 3rd line):

check process background_worker_0
  with pidfile /home/[snip]/pids/
  if not file /home/[snip]/tmp/deploying
  start program = "[snip]"
  stop program = "[snip]"
  restart program = "[snip]"
  if totalmem > 600.0 MB for 5 cycles then restart
  group background_workers

In this case, I would simply "touch tmp/deploying" at the start of the deploy, stop the workers, run through the deploy, start the workers are part of the deploy, and then remove tmp/deploying at the end, then everything is back to normal.

I would think something like this would be easy to add, unfortunately I'm not proficient enough with C/C++ to assist in providing a pull request.

Comments (4)

  1. Tildeslash repo owner

    This is already possible using the Monit group statement. That is, before a deploy, you can run one command to disable monitoring of a set of services and after the deploy, another command to enable monitoring again. Consider:

    check process p1
          group foo
    check process p2
          group foo
    check host h1
          group foo

    With the above config, you can now run this command from the command line monit -g foo unmonitor to unmonitor all services belonging to the group foo. To re-enable monitoring after a deploy, simply run this command, monit -g foo monitor.

  2. Tildeslash repo owner

    Using service groups and -g already provides the same functionality without the need for an external token file.

  3. Log in to comment