Sha256: 88c591405e3d6d97e02668e87acf1ec8daeaab6a16b6426760082c4a3661ff66

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

Struct.new("IOStat",
           :major, :minor, :dev,
           :rio, :rmerge, :rsect, :ruse,
           :wio, :wmerge, :wsect, :wuse,
           :running, :use, :aveq)

collect do
  next if not File.readable?('/proc/diskstats')
  File.open('/proc/diskstats') do |file|
    file.each do |line|
      ios = Struct::IOStat.new(*line.strip.split(/\s+/))
      next if config.skip_numbered.tap{} and ios.dev =~ /\d+$/
      next if config.exclude.map {|e| Regexp.new(e).match(ios.dev)}.any?
      sector_size = File.read("/sys/block/#{ios.dev}/queue/physical_block_size").chomp.to_i rescue 512
      Metriks.derive("os.iostat:#{ios.dev}.rbytes").mark(ios.rsect.to_i * sector_size)
      Metriks.derive("os.iostat:#{ios.dev}.wbytes").mark(ios.wsect.to_i * sector_size)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ganymed-0.5.2 lib/ganymed/collectors/iostat.rb
ganymed-0.5.1 lib/ganymed/collectors/iostat.rb
ganymed-0.5.0 lib/ganymed/collectors/iostat.rb
ganymed-0.4.4 lib/ganymed/collectors/iostat.rb
ganymed-0.4.3 lib/ganymed/collectors/iostat.rb