Sha256: 625a6c2ff526c06ed8b4f0d28c42aa6b889c0e7f033722eebcf00ce0db7f5e27
Contents?: true
Size: 577 Bytes
Versions: 3
Compression:
Stored size: 577 Bytes
Contents
module Perus::Pinger class Temp < Command description 'Measures the temperature of "device" on the client. By default, this will be a CPU.' option :device, default: 'Physical id 0' metric! def run if `uname -s`.strip == 'Darwin' degrees = `istats cpu temp`.split[2].match(/([0-9\.]+)/)[0] else degrees = `sensors | grep "#{options.device}:"`.match(/#{options.device}:\s+(\S+)/)[1] end {temp: degrees.to_f} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
perus-0.1.2 | lib/perus/pinger/metrics/temp.rb |
perus-0.1.1 | lib/perus/pinger/metrics/temp.rb |
perus-0.1.0 | lib/perus/pinger/metrics/temp.rb |