Sha256: f804050af91158c8d98f1e2e7ed0cbe055fe1b3d3328063075d164ab71fdd021

Contents?: true

Size: 1.04 KB

Versions: 51

Compression:

Stored size: 1.04 KB

Contents

always_start true
interval 60

default[:words] = ['reads reqs', 'reads merged', 'reads sector', 'reads time',
                   'writes reqs', 'writes merged', 'writes sector', 'writes time',
                   'io reqs', 'io time', 'io weighted']

default[:filter] = ['reads reqs', 'writes reqs']

run_if do
  File.exists? '/proc/diskstats'
end

collect :os => 'linux' do
  f = File.read('/proc/diskstats')
  f.split("\n").reject { |d| d =~ /(ram|loop)/ }.inject({}) do |_, line|
    if line =~ /^(?:\s+\d+){2}\s+([\w\d]+) (.*)$/
      dev = $1
      values = $2.split(/\s+/).map { |str| str.to_i }
      next if !!(dev.match /\d+$/ || !(dev.match =~ /^xvd/))
      plugin.filter.each do |filter|
        event(:service => "diskstat #{dev} #{filter}", :metric => values[plugin.words.index(filter)].to_f/interval, :diff => true)
      end
      iops = values[plugin.words.index('reads reqs')].to_i + values[plugin.words.index('writes reqs')].to_i
      event(:service => "diskstat #{dev} iops", :metric => iops.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/disk_stat.rb
kurchatov-0.4.6 examples/disk_stat.rb
kurchatov-0.4.5 examples/disk_stat.rb
kurchatov-0.4.4 examples/disk_stat.rb
kurchatov-0.4.3 examples/disk_stat.rb
kurchatov-0.4.2 examples/disk_stat.rb
kurchatov-0.4.1 examples/disk_stat.rb
kurchatov-0.3.8 examples/disk_stat.rb
kurchatov-0.3.7 examples/disk_stat.rb
kurchatov-0.3.6 examples/disk_stat.rb
kurchatov-0.3.5 examples/disk_stat.rb
kurchatov-0.3.4 examples/disk_stat.rb
kurchatov-0.3.3 examples/disk_stat.rb
kurchatov-0.3.2 examples/disk_stat.rb
kurchatov-0.3.1 examples/disk_stat.rb
kurchatov-0.3.0 examples/disk_stat.rb
kurchatov-0.2.9 examples/disk_stat.rb
kurchatov-0.2.8 examples/disk_stat.rb
kurchatov-0.2.7 examples/disk_stat.rb
kurchatov-0.2.6 examples/disk_stat.rb