Pinger
.. isn't ready yet.. move along!
Pinger will be a command line tool for monitoring the health of your websites.
Goals
- Simplicity
- Minimal dependencies
- Email notifications of service interuptions
- Multiple DB adapters
Future Goals
- Simple & sexy web interface with charts/graphs
Configuration
Pinger needs to be setup before doing its job. Pinger will look for your config file at ENV["PINGER_CONFIG"] or ~/.pinger.yml by default.
Here's the available options and their defaults:
:database_url => "sqlite://pinger.db",
:template_path => File.expand_path("../templates", __FILE__),
:email_to => "pinger.alert@example.com",
:email_from => "pinger@example.com",
:deliver_alerts => true,
:delivery_method => :sendmail,
:delivery_method_options => {},
:allowed_response_time_difference => 3,
:allowed_response_size_difference => 1024You'll probably at least want to overwrite database_url and email_to in your yml file:
# ~/.pinger.yml
database_url: postgres://pinger:pinger@localhost/pinger
email_to: your-email@your-host.comWe're using mail for email delivery. To use a different delivery method just set the proper variables in your config file. Here's an example for using gmail:
# ~/.pinger.yml
delivery_method: :smtp
delivery_method_options:
address: "smtp.gmail.com"
port: 587
domain: "example.com"
user_name: "email@example.com"
password: "password"
authentication: "plain"
enable_starttls_auto: trueHere's a link to mail's delivery methods.
Usage
Here's the run down:
pinger help # Shows pinger's usage
pinger stats # Shows stats for pings, alerts and uris
pinger batch # Runs a ping test for all uris in pinger's database
pinger flush # Deletes pings and alerts for all uris
pinger config # Displays pinger's current configuration
pinger list # Lists all uris in pinger's database
pinger add URI # Add a uri to pinger's database
pinger rm URI # Remove a uri from pinger's database
pinger ping URI # Run a ping test for a uri
pinger show URI # Show details for a uriAdd your URIs to pinger's database then tie pinger into your crontab with something like this:
*/15 * * * * /path/to/bin/ruby /path/to/bin/pinger batch >> path/to/pinger.log Testing
Testing is done with minitest. Run tests with:
bundle exec rakeSqlite is used by default, but you can test against other database adapters by setting PINGER_TEST_DB like so:
# postgres
PINGER_TEST_DB=postgres://root:@localhost/pinger bundle exec rake
# mysql
PINGER_TEST_DB=mysql2://root:@localhost/pinger bundle exec rakeMake sure you create the appropriate databases before running the tests.
License
Copyright (c) 2011 - 2012 Spencer Steffen & Citrus, released under the New BSD License All rights reserved.