Sha256: 415030af78a64dedf50b45253bf9fa3127a319076f967ba5d6f031b6a4b9db66

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

class Riemann::Babbler::Net < Riemann::Babbler

  def collect
    f = File.read('/proc/net/dev')
    status = Array.new
    f.split("\n").each do |line|
      iface = line.split(':')[0].strip
      iface.gsub!(/\./, '_')
      next unless line =~ /(\w*)\:\s*([\s\d]+)\s*/
      status << { :service => "#{plugin.service} #{iface} bytes out", :metric => SysInfo::Net.out(iface, 'bytes'), :as_diff => true }
      status << { :service => "#{plugin.service} #{iface} bytes in", :metric => SysInfo::Net.in(iface, 'bytes'), :as_diff => true }
      status << { :service => "#{plugin.service} #{iface} bytes errors", :metric => SysInfo::Net.total(iface, 'errors'), :state => 'ok' }
    end
    status
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riemann-babbler-1.1.0pre2 lib/riemann/babbler/plugins/net.rb