lib/shared/pe_status_check.rb
# Get the free disk percentage from a path
# @param name [String] The path on the file system
# @return [Integer] The percentage of free disk space on the mount
Get the free disk percentage from a path
Get the free disk percentage from a path
def filesystem_free(path)
    require 'sys/filesystem'
    stat = Sys::Filesystem.stat(path)
    (stat.blocks_available.to_f / stat.blocks.to_f * 100).to_i
  rescue LoadError => e
    Facter.warn("Error in fact 'pe_status_check': #{e.message}")
    Facter.debug(e.backtrace)
    0
  end
def filesystem_free ( path ) require 'sys/filesystem' stat = Sys :: Filesystem . stat ( path ) ( stat . blocks_available . to_f / stat . blocks . to_f * 100 ) . to_i rescue LoadError => e Facter . warn ( "Error in fact 'pe_status_check': #{e.message}" ) Facter . debug ( e . backtrace ) 0 end
Get the free disk percentage from a path
Get the free disk percentage from a path
The percentage of free disk space on the mount
The percentage of free disk space on the mount
Integer
path
name
The path on the file system
The path on the file system