Are there any examples on the web of how to monitor delayed_job with Monit?
Everything I can find uses God, but I refuse to use God since long running processes in Ruby generally suck. (The most current post in the God mailing list? God Memory Usage Grows Steadily.)
Update: delayed_job now comes with a sample monit config based on this question.
If your monit is running as root and you want to run delayed_job as my_user then do this:
/etc/init.d/delayed_job:
/var/www/my_app/shared/monit/delayed_job.monitrc:
/etc/monit/monitrc:
I found it was easier to create an init script for delayed job. It is available here: http://gist.github.com/408929 or below:
Then make sure that monit is set to start / restart the app so in your monitrc file:
and that works great!
to see what is going on, run monit in foreground verbose mode:
sudo monit -Iv
using
rvm
installed under user "www1" and group "www1".in file
/etc/monit/monitrc
:I don't know with Monit, but I've written a couple Munin plugins to monitor Queue Size and Average Job Run Time. The changes I made to delayed_job in that patch might also make it easier for you to write Monit plugins in case you stick with that.
I found a nice way to start delayed_job with cron on boot. I'm using whenever to control cron.
My schedule.rb:
Note: I upgraded whenever gem to 0.5.0 version to be able to use job_type
Since i didn't want to run as root, I ended up creating a bash init script that monit used for starting and stopping (PROGNAME would be the absolute path to script/delayed_job):