summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/windows/uptime.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ohai/plugins/windows/uptime.rb')
-rw-r--r--lib/ohai/plugins/windows/uptime.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ohai/plugins/windows/uptime.rb b/lib/ohai/plugins/windows/uptime.rb
index 2dcc0e48..8187b1b7 100644
--- a/lib/ohai/plugins/windows/uptime.rb
+++ b/lib/ohai/plugins/windows/uptime.rb
@@ -17,7 +17,11 @@
#
require 'ruby-wmi'
-provides "uptime", "uptime_seconds"
+Ohai.plugin(:Uptime) do
+ provides "uptime", "uptime_seconds"
-uptime_seconds ::WMI::Win32_PerfFormattedData_PerfOS_System.find(:first).SystemUpTime.to_i
-uptime seconds_to_human(uptime_seconds)
+ collect_data do
+ uptime_seconds ::WMI::Win32_PerfFormattedData_PerfOS_System.find(:first).SystemUpTime.to_i
+ uptime seconds_to_human(uptime_seconds)
+ end
+end