Skip to content

Instantly share code, notes, and snippets.

@matthewskelton
Created July 8, 2013 17:50
Show Gist options
  • Save matthewskelton/5950922 to your computer and use it in GitHub Desktop.
Save matthewskelton/5950922 to your computer and use it in GitHub Desktop.
Example of how ohai uses WMI under the hood to determine node data on Windows
# From https://github.com/opscode/ohai/blob/master/lib/ohai/plugins/windows/uptime.rb e803a3f
require 'ruby-wmi'
provides "uptime", "uptime_seconds"
uptime_seconds ::WMI::Win32_PerfFormattedData_PerfOS_System.find(:first).SystemUpTime.to_i
uptime self._seconds_to_human(uptime_seconds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment