Sha256: a7b5bd18803db6e9b2f5661d3aab3fefd0d17825dc2dba1f342a29c0181ed0a0
Contents?: true
Size: 1.3 KB
Versions: 20
Compression:
Stored size: 1.3 KB
Contents
report do # ------------------------------------------------------------------------------ # mounts # mounts = {} current_dev = nil uuids = Hash[Dir["/dev/disk/by-uuid/*"].collect{|i| [File.expand_path(File.readlink(i), File.dirname(i)), File.basename(i)] }] File.read("/etc/mtab").lines.each do |line| dev,mount,fstype,flags,dump,pass = line.split(/\s+/) mounts[dev] = { :mount => mount, :device => dev, :filesystem => fstype, :flags => flags.split(/\s*,\s*/), :uuid => uuids[dev] }.compact end # logical space utilization Facter::Util::Resolution.exec("df 2> /dev/null").to_s.lines.each do |line| next if line =~ /^Filesystem/ parts = line.split(/\s+/) if parts.length == 1 current_dev = parts.first next else dev,kblk,used,free,percent,mount = parts dev = current_dev if dev.empty? next unless mounts[dev] and mounts[dev].is_a?(Hash) mounts[dev][:used] = (used.to_i * 1024) mounts[dev][:available] = (free.to_i * 1024) mounts[dev][:total] = (mounts[dev][:available] + mounts[dev][:used]) mounts[dev][:percent_used] = percent.delete('%').to_i end end stat 'disk.@mounts', (Hash[mounts.select{|k,v| k =~ /^\/dev\/((h|s|xv|v)d|mapper|vgc)/ }].values rescue nil) end
Version data entries
20 entries across 20 versions & 2 rubygems