Skip to content
Smit Patel edited this page Jan 5, 2016 · 1 revision

Q: There is a command line option for a "monitor process". What is that?

A: It passes true for :monitor to this method: http://daemons.rubyforge.org/classes/Daemons.html#M000004

Also, delayed_job can be easily monitored with monit:

check process delayed_job with pidfile /var/www/current/tmp/pids/delayed_job.pid
        start program = "/var/www/current/script/delayed_job -e production start" as uid ubuntu and gid ubuntu
        stop program = "/var/www/current/script/delayed_job -e production stop" as uid ubuntu and gid ubuntu
        if mem is greater than 300.0 MB for 1 cycles then restart
        if cpu is greater than 50% for 2 cycles then alert
        if cpu is greater than 80% for 3 cycles then restart
        group background

To use monit with delayed_job workers you can use -i (identifier) command line switch.

check process delayed_job_0 with pidfile /var/www/current/tmp/pids/delayed_job.0.pid
        start program = "/var/www/current/script/delayed_job -e production start -i 0" as uid ubuntu and gid ubuntu
        stop program = "/var/www/current/script/delayed_job -e production stop -i 0" as uid ubuntu and gid ubuntu
        if mem is greater than 300.0 MB for 1 cycles then restart
        if cpu is greater than 50% for 2 cycles then alert
        if cpu is greater than 80% for 3 cycles then restart
        group background
check process delayed_job_1 with pidfile /var/www/current/tmp/pids/delayed_job.1.pid
        start program = "/var/www/current/script/delayed_job -e production start -i 1" as uid ubuntu and gid ubuntu
        stop program = "/var/www/current/script/delayed_job -e production stop -i 1" as uid ubuntu and gid ubuntu
        if mem is greater than 300.0 MB for 1 cycles then restart
        if cpu is greater than 50% for 2 cycles then alert
        if cpu is greater than 80% for 3 cycles then restart
        group background

Giangprosite_job

Clone this wiki locally