Skip to content

eggplantbr/health_check

 
 

Repository files navigation

health_check

Simple health check of Rails app for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.

The basic goal is to quickly check that rails is up and running and that it has access to correctly configured resources (database, email gateway)

The email gateway is not checked unless the smtp settings have been changed. Specify full or include email in the list of checks to varify the smtp settings (eg use 127.0.0.1 instead of localhost).

health_check provides various monitoring URIs

% curl localhost:3000/health_check
success

% curl localhost:3000/health_check/standard
success

% curl localhost:3000/health_check/all
success

% curl localhost:3000/health_check/site_and_database_and_email_migrations
success

The health_check controller disables sessions and logging for its actions to minimise the impact of frequent uptime checks on the session store and the log file.

Installation

As a Gem from rubygems (Rails 3.0 and above)

Add the following line to Gemfile

gem "health_check"

Then run

% bundle

As a Gem from rubygems (Rails 2.3)

Install the gem using the following command

% gem install health_check

Then add the following line to config/environment.rb within the config block

config.gem "health_check"

As a Plugin (Rails 2.3.x)

Run the following commands from the root of your rails application

% cd vendor/plugins
% git clone git://github.com/ianheggie/health_check.git

Uptime Monitoring

Use a website monitoring service to check the url regularly for the word “success” rather than just a 200 return code.

See

Checks

  • standard (default) - site, database and migrations checks are run plus email if settings have been changed

  • all / full - all checks are run

  • database - checks that the current migration level can be read from the database

  • email - basic check of email - :test returns true, :sendmail checks file is present and executable, :smtp sends HELO command to server and checks response

  • migration - checks that the database migration level matches that in db/migrations

  • site - checks rails is running sufficiently to render text

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010-2013 Ian Heggie, released under the MIT license. See MIT-LICENSE for details.

Known Issues

  • No inline documentation for methods

  • Feedback welcome especially with suggested replacement code and corresponding tests

Similar projects

  • fitter_happier plugin by atmos - plugin with similar goals, but not compatible with uptime, and does not check email gateway

Continuous integration tests

See Travis CI testing result: <img src=“https://travis-ci.org/ianheggie/health_check.png” />

Versions

  • 0.x - Rails 2.3

  • 1.x - Includes Rails 3.x suppprt as an Engine

  • 1.0.2 - Included travis config and gemfiles used in travis tests in gem and changes to test setup so that gem test

About

Simple health check of Rails app for use with uptime.openacs.org or wasitup.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published