Sha256: 318a3ce9007258d2a69607dcbfa3f6aa0da705c49e68dc618857f6cc62cd1210

Contents?: true

Size: 1.9 KB

Versions: 18

Compression:

Stored size: 1.9 KB

Contents

report do
# ------------------------------------------------------------------------------
# LVM
#
  vg = {}

# volume groups
  Facter::Util::Resolution.exec("vgdisplay -c 2> /dev/null").to_s.lines.each do |line|
    line = line.strip.chomp.split(':')

    vg[line[0]] = {
      :name    => line[0],
      :uuid    => line[16],
      :size    => (line[11].to_i*1024),
      :extents => {
        :size      => (line[12].to_i * 1024),
        :total     => line[13].to_i,
        :allocated => line[14].to_i,
        :free      => line[15].to_i
      },
      :volumes => [],
      :disks => []
    }
  end

# logical volumes
  Facter::Util::Resolution.exec("lvdisplay -c 2> /dev/null").to_s.lines.each do |line|
    line = line.strip.chomp.split(':')

    unless vg[line[1]].nil?
      vg[line[1]][:volumes] << {
        :name    => line[0],
        :sectors => line[6].to_i,
        :extents => line[7].to_i,
        :size    => (vg[line[1]][:extents][:size] * line[7].to_i)
      }
    end
  end


# physical volumes
  Facter::Util::Resolution.exec("pvdisplay -c 2> /dev/null").to_s.lines.each do |line|
    line = line.strip.chomp.split(':')

    unless vg[line[1]].nil?
      vg[line[1]][:disks] << {
        :name    => line[0],
        :uuid    => line[11],
        :size    => (line[8].to_i * (line[7].to_i * 1024)),  # See Note 1 below
        :extents => {
          :size      => (line[7].to_i * 1024),
          :total     => line[8].to_i,
          :allocated => line[10].to_i,
          :free      => line[9].to_i
        }
      }

    # the output of certain versions of pvdisplay -c reports a blatantly incorrect
    # physical volume total size.  the workaround is to calculate the actual total size
    # via (total extents * extent size)
    #
    # this may or may not be GPT related
    #
    end
  end

  lvm = {}
  lvm = {
    :groups => vg.values
  } unless vg.values.empty?

  stat 'disk.@lvm', lvm unless lvm.empty?
end

Version data entries

18 entries across 18 versions & 2 rubygems

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