Module: Facter::Util::Uptime

Defined in:
lib/facter/util/uptime.rb

Overview

A module to gather uptime facts

Class Method Summary collapse

Class Method Details

.get_uptime_seconds_unixObject



6
7
8
# File 'lib/facter/util/uptime.rb', line 6

def self.get_uptime_seconds_unix
  uptime_proc_uptime or uptime_sysctl or uptime_executable
end

.get_uptime_seconds_winObject



10
11
12
13
14
15
16
17
18
# File 'lib/facter/util/uptime.rb', line 10

def self.get_uptime_seconds_win
  require 'facter/util/wmi'

  last_boot = ""
  Facter::Util::WMI.execquery("select * from Win32_OperatingSystem").each do |x|
    last_boot = x.LastBootupTime
  end
  self.compute_uptime(Time.parse(last_boot.split('.').first))
end