Sha256: e2a2ae0b3c13b116cdc7b9d0db410c78264823f9cfeb4b7a64ae8565a06d7d66

Contents?: true

Size: 584 Bytes

Versions: 19

Compression:

Stored size: 584 Bytes

Contents

require 'net/ntp'

class Riemann::Babbler::Plugin::Ntp < Riemann::Babbler::Plugin

  def init
    plugin.set_default(:service, 'ntp')
    plugin.set_default(:host, 'pool.ntp.org')
    plugin.set_default(:server_timeout, 30)
    plugin.states.set_default(:warning, 5)
    plugin.states.set_default(:critical, 10)
  end

  def collect
    {
      :service     => plugin.service + " #{plugin.host}",
      :description => "Ntp lag with host #{plugin.host}",
      :metric      => (::Net::NTP.get(plugin.host, 'ntp', plugin.server_timeout).time.to_f - Time.now.to_f).abs
    }
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
riemann-babbler-2.8.5 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.8.4 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.8.3 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.8.2 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.8.1 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.8.0 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.6.0 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.9 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.8 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.7 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.6 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.5 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.4 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.3 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.2 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.1 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.5.0 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.1.5 lib/riemann/babbler/plugins/ntp.rb
riemann-babbler-2.1.4 lib/riemann/babbler/plugins/ntp.rb