Monitors the delayed_job plugin's queue and periodically tests its ability to deliver e-mail messages and e-mails you if something goes wrong, such as the delayed_job process crashes or one of its jobs fails or takes too long to complete.
The delayed_job_tracer gem is designed to monitor the delayed_job gem (https://github.com/collectiveidea/delayed_job). It will alert you via e-mail if something goes wrong, such as if the delayed_job process crashes or one of its jobs fails or takes too long to complete.
This gem also detects wither e-mails sent through delayed_job are actually being delivered by sending test messages (like tracer bullets) to an e-mail account then checking that account to ensure they were processed and dispatched via the delayed_job queue. The e-mail delivery detection allows you to be notified if e-mails can’t be sent out either because of delayed_job having choked or because of an issue with the e-mail account the application uses to send e-mail.
Note: These are for Ubuntu. You may need to find alternate packages for your platform.
sudo apt-get install libxml2-dev libxslt-dev libnet-ssleay-perl libcrypt-ssleay-perl libio-socket-ssl-perl
Download from http://caspian.dotconf.net/menu/Software/SendEmail and follow the setup instructions, or just follow these instructions:
wget -c http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
tar xvfz sendEmail-v1.56.tar.gz
sudo cp -a sendEmail-v1.56/sendEmail /usr/local/bin
chmod +x /usr/local/bin/sendEmail
Run it to be sure it works:
sendEmail
Cleanup:
rm -rf sendEmail-v1.56*
gem “delayed_job_tracer”
rails g delayed_job_tracer
Create a ‘DelayedJobTracer’ folder/label in the e-mail account you configure the plugin to send test messages to and a filter to move all incoming messages with ‘[DelayedJobTracer]’ in the subject line to this folder (or label if you’re using Gmail). Set the name of this folder in the config/delayed_job_tracer_config.yml file - as it will be the folder that the Ruby process checks for test messages.
Add a Cron job on the server:
Example for running every 15 minutes, replace with your actual app and ruby locations:
*/15 * * * * /usr/local/bin/delayed_job_tracer -c /opt/apps/appname/current/config/delayed_job_tracer_config.yml
Note: If you’re using bundler to install gems within an application-specific gem environment, you may need to also install the gem manually on the server so that the executable is available via the location in the example cron entry above.
Finish configuring your settings in the config/delayed_job_tracer_config.yml file. Your database and ActionMailer config will be applied via the generator, but you’ll still need to provide an alternate e-mail account to send administrative notifications through, provide the admin’s e-mail address and so forth.