Net::Ntp::Check

Build Status Gem Version Coverage Status Code Climate

Checks NTP offset against several NTP servers and allows pushing of offset stats via statsd

Installation

Add this line to your application's Gemfile:

gem 'net-ntp-check'

And then execute:

$ bundle

Or install it yourself as:

$ gem install net-ntp-check

Usage

Get NTP offsets based on several servers

require 'net/ntp/check'
offsets = Net::NTP::Check.get_offsets

Get NTP offset based on several servers with a 200ms bandpass filter applied

require 'net/ntp/check'
offsets = Net::NTP::Check.get_offsets_filtered

Send NTP offset to statsd

require 'net/ntp/check'
client = Net::NTP::Check::StatsdClient.new
client.send_offset_stats

Statsd Error Codes

  • 0 - Success
  • 1 - Unknown Error
  • 2 - Timeout Error
  • 3 - Socket Error (failed DNS resolution)

Contributing

  1. Fork it ( https://github.com/pagerduty/net-ntp-check/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request