class Remon::Metrics::Disk
Public Instance Methods
disks_usage()
click to toggle source
# File lib/remon/metrics/disk.rb, line 5 def disks_usage disks = [] IO.popen(['df', '-h']) do |io| io.each_line do |l| f = l.split(/\s+/) next if f[0] == 'Filesystem' next unless f[0] =~ /\// # Needs at least one slash in the mount path disk_info = {} disk_info[:mount] = f[5] disk_info[:percent] = (f[4].to_f/100).round(2) disk_info[:size] = f[1] disks << disk_info end end disks end