0

我正在使用 ruby​​ 1.9.2p280、rubyonrails 3.07 和 apache 乘客部署 Rubyonrails Web 应用程序,并将延迟作业作为后台作业。

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

我找不到任何分步指南。

非常感谢你

4

1 回答 1

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/bin/delayed_job_start

#!/bin/sh

cd /mnt/<project> && RAILS_ENV=production ruby script/delayed_job start
于 2011-12-25T03:44:41.380 回答