Sha256: 377d74fa5629816b4ac5de5696783fdf3b289a751436f6e457475c80ac96669e

Contents?: true

Size: 950 Bytes

Versions: 51

Compression:

Stored size: 950 Bytes

Contents

interval 60
always_start true

default[:include_alias] = false
default[:filter] = ['rx bytes', 'rx errs', 'rx drop', 'tx bytes', 'tx errs', 'tx drop']
default[:words] = ['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']

collect :os => 'linux' do
  File.read('/proc/net/dev').each_line do |line|
    iface = line.split(':')[0].strip
    iface.gsub!(/\./, '_')
    next if (iface =~ /\./ && !plugin.include_alias)
    next unless line =~ /(\w*)\:\s*([\s\d]+)\s*/
    plugin.words.map do |service|
      service
    end.zip(
        $2.split(/\s+/).map { |str| str.to_i }
    ).each do |service, value|
      next unless plugin.filter.include? service
      event(:service => "net #{iface} #{service}", :metric => value.to_f/interval, :diff => true)
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
kurchatov-0.4.7 examples/net.rb
kurchatov-0.4.6 examples/net.rb
kurchatov-0.4.5 examples/net.rb
kurchatov-0.4.4 examples/net.rb
kurchatov-0.4.3 examples/net.rb
kurchatov-0.4.2 examples/net.rb
kurchatov-0.4.1 examples/net.rb
kurchatov-0.3.8 examples/net.rb
kurchatov-0.3.7 examples/net.rb
kurchatov-0.3.6 examples/net.rb
kurchatov-0.3.5 examples/net.rb
kurchatov-0.3.4 examples/net.rb
kurchatov-0.3.3 examples/net.rb
kurchatov-0.3.2 examples/net.rb
kurchatov-0.3.1 examples/net.rb
kurchatov-0.3.0 examples/net.rb
kurchatov-0.2.9 examples/net.rb
kurchatov-0.2.8 examples/net.rb
kurchatov-0.2.7 examples/net.rb
kurchatov-0.2.6 examples/net.rb