通过监控监视多个延迟的工作人员 [英] monitoring multiple delayed job workers with monit

查看:102
本文介绍了通过监控监视多个延迟的工作人员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多有关监视monit的delay_job的信息。该实现非常简单直接。但是,当一个工作人员还不够时,我该如何设置监控以确保10个工作人员一直在运行?

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?

推荐答案

您可以复制与第一个工作程序相同的配置N次。
假设您有5个工人,则将使用以下命令监视所有工人:

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"

这篇关于通过监控监视多个延迟的工作人员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆