Sha256: 44fb9d8e9576d0dd5eeec467666189d4106dee6b8a09d89b4c05c0a1ffaf1bda
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
class Riemann::Babbler::Net include Riemann::Babbler def plugin options.plugins.net end def net f = File.read('/proc/net/dev') net = f.split("\n").inject({}) do |s, line| if line =~ /\s*(\w+?):\s*([\s\d]+)\s*/ iface = $1 ['rx bytes', 'rx packets', 'rx errs', 'rx drop', 'rx fifo', 'rx frame', 'rx compressed', 'rx multicast', 'tx bytes', 'tx packets', 'tx drops', 'tx fifo', 'tx colls', 'tx carrier', 'tx compressed'].map do |service| "#{iface} #{service}" end.zip( $2.split(/\s+/).map { |str| str.to_i } ).each do |service, value| s[service] = value end end puts s end end def tick status = { :service => plugin.service, :state => 'ok' } report status end end Riemann::Babbler::Net.run
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riemann-babbler-0.0.3 | lib/riemann/babbler/plugins/net.rb |