summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraliasgar16 <aliasgar.batterywala@clogeny.com>2016-09-08 17:10:46 +0530
committeraliasgar16 <aliasgar.batterywala@clogeny.com>2016-09-08 17:10:46 +0530
commit9e1d36e85b8317cf2999495768f641d7ab90f67f (patch)
tree4a74d0181db19a1d14c3cdb10efa64b460774d06 /lib
parent13485c17da688654890047d1952d9f71e735d162 (diff)
downloadohai-9e1d36e85b8317cf2999495768f641d7ab90f67f.tar.gz
Changed WMI class from which to retrieve the system uptime for ohai uptime plugin.
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/plugins/uptime.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ohai/plugins/uptime.rb b/lib/ohai/plugins/uptime.rb
index c1cc5be5..d8ffbdf9 100644
--- a/lib/ohai/plugins/uptime.rb
+++ b/lib/ohai/plugins/uptime.rb
@@ -96,7 +96,8 @@ Ohai.plugin(:Uptime) do
collect_data(:windows) do
require "wmi-lite/wmi"
wmi = WmiLite::Wmi.new
- uptime_seconds wmi.first_of("Win32_PerfFormattedData_PerfOS_System")["systemuptime"].to_i
+ last_boot_up_time = wmi.first_of("Win32_OperatingSystem")["lastbootuptime"]
+ uptime_seconds Time.new.to_i - Time.parse(last_boot_up_time).to_i
uptime seconds_to_human(uptime_seconds)
end