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