Downtime

downtime checks your connection to a host (8.8.8.8) and aggregates the up- or downtimes (connection or no connection) in a file in a human readable format. Connection is made via a call to dig +time=1 +tries=1 8.8.8.8, so your ruby process needs to be able to call that command - although it would be really easy to change which tool is used.

It was made to track e.g. outages of your ISP.

The implementation ignores all IOs beauty and treats file read and scan actions as free actions. Be warned.

Installation

Add this line to your application's Gemfile:

gem 'downtime'

And then execute:

$ bundle

Or install it yourself as:

$ gem install downtime

Usage

Use as a cron-job (use [god]-gem if you like).

Call as downtime. It will create a downtime.log file in the current working directory.

The file (downtime.log) will look like this:

# This file was generated by the downtime ruby gem.
2015-01-01-10-22 up till 2015-01-02-08-10
! went down after 1000 minutes up
2015-01-02-08-10 down till 2015-01-03-08-40
! went up after 30 minutes down
2015-01-02-08-40 up till 2015-01-03-08-45

Caveats

Its assumed you run in CET timezone.

Contributing

  1. Contact me, either by creating an issue or sending me a mail - sometimes stuff is more easily done at two!
  2. Fork it ( https://github.com/[my-github-username]/downtime/fork )
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request