Find file
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (82 sloc) 3.98 KB


Build Log

A simple way to see what's up, dawg (and what's not.)

Suggested usage:

  • Define a list of checks and create a controller that renders the results. Ping the controller with the monitoring tool of your choice, perhaps setting a 503 response when one of the checks fails.

  • Use as a language for writing Nagios checks.

Some options can be set:

UpDawg.configure do |config|
  config.success_text = 'OK'

Checks are defined with a simple DSL:

monitor = Updawg.monitor do
  check 'MySQL' do
    # Will raise an exception if the connection is unavailable resulting in a failed check
    ActiveRecord::Base.connection.execute('SELECT 1 FROM DUAL')

  check 'Some threshold' do
    result ||=   error('Threshold exceeded y') if threshold_value > y
    result ||= warning('Threshold exceeded x') if threshold_value > x

  # alternatively, use warning!/error!/pass! to break out of the check immediately
  check 'Something else' do
    warning!('Something kind of bad happened') if threshold_value > x
    error!  ('Something really bad happened')  if threshold_value > y

	pass!('Everything is just fine')

  # Specify a threshold check for captured purchases in the last 24 hours
  threshold 'Captured Purchases (24 hours)', :warn_under => 10, :error_under => 1 do

  # Specify a "sweet spot threshold check" to alert when a business metric goes out of normal range
  threshold 'Transactions (24 hours)',
            :warning_under => 100, :error_under => 1,
            :warning_over => 1000, :error_over => 2000 do

  # Specify a std deviation check to alert when a value is outside of 2 std deviations from the mean
  # The block should yield an array of values, the last of which is considered the sample.
  # Supports options:
  #   scale_factor - multiple of the std_dev to user (default: 2)
  #   smoothing - whether to ignore outliers in the dataset (default: true)
  #   skip_if_minimum_below - set to a value to skip this check for values that would be very small (default: false)
  #   skip_if_maximum_above - set to a value to skip this check for values that would be very large (default: false)
  deviation 'Hourly Transaction Value' do'hour').order('hour ASC') # will report if the last hour of data is out of range

results = monitor.perform

results.success? => true if no checks error
results.warning? => true if no checks error and at least one has a warning
results.error?   => true if at least one check fails

Render with:


<table class="updawg monitor">
  <tr class="check error">
    <td class="name">MySQL</td>
    <td class="message">ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax</td>
    <td class="status">ERROR</td>
  <tr class="check pass">
    <td class="name">Some threshold</td>
    <td class="message"></td>
    <td class="status">PASS</td>

Nagios Integration

Use Updawg to easily script nagios checks in Ruby.  Create your checks as usual and call #nagios_report!
on the result.  Updawg will print a status line formatted for nagios and exit with an appropriate status code.

Note on Patches/Pull Requests

  • Fork the project.

  • Create a feature branch and make your feature addition or bug fix there.

  • 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.


Matt Griffin (


Copyright © 2010 Viximo, Inc. See LICENSE for details.