使用monit监视工具设置Delayed_job

时间:2011-12-25 02:29:41

标签: ruby-on-rails-3 monitoring delayed-job monit

我正在使用ruby 1.9.2p280部署Rubyonrails网络应用程序,使用apache passenger和delayed_job作为后台工作部署rubyonrails 3.07。

我想监视我的乘客以及delayed_job后台工作。

我找不到任何一步一步的指南。

非常感谢你

1 个答案:

答案 0 :(得分:1)

如下所述添加以下.monitrc文件,并运行命令monit reload以加载配置。

<强> /etc/monit/web.monitrc

check process apache with pidfile /var/run/apache2.pid
  start program = "/etc/init.d/apache2 start"
  stop program  = "/etc/init.d/apache2 stop"
  if cpu > 80% for 5 cycles then restart
  if totalmem > 300.0 MB for 5 cycles then restart
  if children > 250 then alert
  if failed port 80 with timeout 10 seconds then restart
  if 3 restarts within 5 cycles then timeout
  mode manual
  group web

<强> /etc/monit/delayed_job.monitrc

check process delayed_job with pidfile /mnt/<project>/tmp/pids/delayed_job.pid
  start program = "/usr/bin/delayed_job_start"
  stop program = "/usr/bin/delayed_job_stop"
  mode manual
  group delayed_job

<强>的/ usr /斌/ delayed_job_start

#!/bin/sh

cd /mnt/<project> && RAILS_ENV=production ruby script/delayed_job start