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

Version Path
onering-report-0.6.13 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.12 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.11 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.10 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.9 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.8 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.7 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.6 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-0.6.5 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.65 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.64 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.63 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.62 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.61 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.60 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.59 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.58 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.57 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.56 lib/reporter/default/properties_system_disk_mounts.rb
onering-report-plugins-0.0.55 lib/reporter/default/properties_system_disk_mounts.rb