Net::Ntp::Check
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
- Fork it ( https://github.com/pagerduty/net-ntp-check/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request