In my work I have an Rails application wich uses Delayed Job to do some work, like exporting PDF files. We ran in to some trouble with the jobs wich caused them to stall. Then I began searching for some kind of monitoring for the Delayed Job worker, I found some very usefull thing to see if the Delayed Jobs were running… This was not the problem I was facing though, I was having trouble with jobs that couldn’t upload files for example. So the Delayed Job worker process was running, it was just not doing anything usefull.
So that I searched further, and found delayed_job-monitor by Michael Guterl on Github. The gem he wrote is a good starting point for me. But I wanted to be able to add an config file. I also didn’t like the name and the way it connected into Delayed::Job. That last bit is a matter of opion. I decided to create a own gem, and so DJMonitor was born. This gem in core is a ripped version of the delayed_job-monitor gem. Wich in base is very nice.
DJMonitor works like this:
- gem install dj-monitor –pre
- cd to the rails app (
cd /var/rails_apps/delay/current) - create a dj-monitor.yml file! This bit is important fow now (else I get spammed)
- run
dj-monitor
The dj-monitor.yml file is meant for configuring the gem. Here you can (and must) set options for DJMonitor to send the right mails. A example dj-monitor.yml file looks like this:
1 2 3 | |
When setup right, the gem will mail you a summery overview when things go bad. I have set this gem up as a crontask. Be sure to use the full path to the dj-monitor command (whereis dj-monitor) else cron might be confused what you mean.
If you have any issues (bare in mind that this gem is a beta release, things can go wrong!) please report them to me!
Thanks for reading!