Sha256: ffd09127bd7977a67df95a232e2abb08988897fcec53cf6767537d91e7383bf3

Contents?: true

Size: 685 Bytes

Versions: 1

Compression:

Stored size: 685 Bytes

Contents

# A module to gather uptime facts
#
module Facter::Util::Uptime

    def self.get_uptime_simple
        time = Facter::Util::Resolution.exec('uptime')
            if time =~ /up\s*(\d+\s\w+)/
                $1
            else
                "unknown"
            end
    end

    def self.get_uptime
        uptime, idletime = File.open("/proc/uptime").gets.split(" ")
        uptime_seconds = uptime.to_i
    end

    def self.get_uptime_period(seconds, label)
        
        case label
        when 'days'
            value = seconds / 86400
        when 'hours'
            value = seconds / 3600
        when 'seconds'
            seconds
        end     
   
    end

end   

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facter-1.5.3 lib/facter/util/uptime.rb