monitoring multiple delayed job workers with monit

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 02:06:19

问题


I have read a lot about monitoring delayed_job with monit. The implementation is pretty easy and straight forward. But When one worker is not enough how do I setup monit to ensure that, let's say, 10 workers are constantly running?


回答1:


You can just replicate the same config you have for the first worker N times. Suppose you have 5 workers, you'll monitor all of them with the following:

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"


来源:https://stackoverflow.com/questions/6071970/monitoring-multiple-delayed-job-workers-with-monit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!