monitor rails health" />

Rails Application Health Monitor

December 13, 2009

Most rails applications have many additional moving parts of which the health cannot be assessed with simply pinging the (hopefully page cached) homepage

For example,

  • Is Email is sent successfully?
  • Is the SMS gateway alive and you bought sufficient credits?
  • All database connections are alive? Backgroundrb down again?
  • The cloud computing setup jacked the imagemagick? Again?
  • You are running out of disk space and there are no more file descriptors for your
  • The git SHA and version is correct
  • Screen shot 2009-12-06 at 12.29.53 AM

Health Monitor adds a single controller action to generate an html, js, or xml report with details of all your custom defined health checks. An error response code (500 server error) indicates failure when any monitored feature fails or exceeds the custom timeout definition. Health monitor is easier to setup than custom server side cron tasks and adds the advantage of exercising more code since everything from your load balancer to nginx to mongrels must be happily shoving rubies around to get that 200 oh boy success message. So ping away, grab a beer and know that hey, you might be too drunk but at least you will know your application is sick before your clients do.


sudo gem install health_monitor --source=

config.gem :health_monitor, :source =>

Create a the health monitor controller

script/generate health_monitor

Add your customizations

  class HealthMonitorController < ApplicationController

    #More examples available at
    #Built in checks
    monitor_health :schema_check, :database_check, :ey_agent_check

    #monitor specified process
    monitor_process :monit 

    # Custom monitor task
    monitor_health :email, :description => 'send an email' do |controller|


Routes are automatically generated:



Monitor specific tasks or skip tasks with the parameters skip and only



Leave a Reply