使用monit监控多个延迟的工作人员

我已经阅读了很多关于使用monit监视delayed_job的内容。 实施非常简单直接。 但是当一个工人不够时,我该如何设置monit来确保10个工人不断运行呢?

您可以为第一个工作人员复制相同的配置N次。 假设您有5名工人,您将使用以下内容监控所有工人:

check process delayed_job.0 with pidfile /path/to/shared/pids/delayed_job.0.pid start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user" stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user" check process delayed_job.1 with pidfile /path/to/shared/pids/delayed_job.1.pid start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user" stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user" check process delayed_job.2 with pidfile /path/to/shared/pids/delayed_job.2.pid start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user" stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user" check process delayed_job.3 with pidfile /path/to/shared/pids/delayed_job.3.pid start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user" stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user" check process delayed_job.4 with pidfile /path/to/shared/pids/delayed_job.4.pid start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user" stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"