Sha256: 073d324a4c15b03a51e1b727fe170eff2cc98371ca8aa9173f882e328a8c7b62

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

module Remon
  module Metrics
    class Disk

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remon-0.1.0 lib/remon/metrics/disk.rb