Sha256: 86eef5da3d9fc622666f31c27ef8dafe63d392553f2f6a482c03850e2c6e8a8e

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 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

14 entries across 14 versions & 1 rubygems

Version Path
kurchatov-0.0.5.pre5 examples/disk_stat.rb
kurchatov-0.0.5.pre4 examples/disk_stat.rb
kurchatov-0.0.5.pre2 examples/disk_stat.rb
kurchatov-0.0.5.pre1 examples/disk_stat.rb
kurchatov-0.0.4 examples/disk_stat.rb
kurchatov-0.0.4d examples/disk_stat.rb
kurchatov-0.0.4c examples/disk_stat.rb
kurchatov-0.0.4b examples/disk_stat.rb
kurchatov-0.0.3 examples/disk_stat.rb
kurchatov-0.0.3b examples/disk_stat.rb
kurchatov-0.0.3a examples/disk_stat.rb
kurchatov-0.0.2 examples/disk_stat.rb
kurchatov-0.0.2b examples/disk_stat.rb
kurchatov-0.0.1 examples/disk_stat.rb