Sha256: 65ba79927c170daca7b1933443e0123cf5232486d2e17bebd40a4bf030994884

Contents?: true

Size: 552 Bytes

Versions: 3

Compression:

Stored size: 552 Bytes

Contents

class Riemann::Babbler::Disk
  include Riemann::Babbler

  def plugin
    options.plugins.disk
  end

  def disk
    disk = {}
    `df -P`.split(/\n/).each do |r|
      f = r.split(/\s+/)
      next unless f[0] =~ /^\//
      next if f[0] == 'Filesystem'
      x = f[4].to_f/100
      disk.merge!({f[5] => x})
    end
    disk
  end

  def tick
    disk.each do |point, free|
      report({
        :service => plugin.service + " #{point}",
        :state => state(free),
        :metric => free
      })
    end
  end

end

Riemann::Babbler::Disk.run

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riemann-babbler-0.0.8 lib/riemann/babbler/plugins/disk.rb
riemann-babbler-0.0.7 lib/riemann/babbler/plugins/disk.rb
riemann-babbler-0.0.6 lib/riemann/babbler/plugins/disk.rb