lib/perus/pinger/metrics/temp.rb in perus-0.1.2 vs lib/perus/pinger/metrics/temp.rb in perus-0.1.3

- old
+ new

@@ -4,13 +4,13 @@ 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] + if darwin? + degrees = shell('istats cpu temp').split[2].match(/([0-9\.]+)/)[0] else - degrees = `sensors | grep "#{options.device}:"`.match(/#{options.device}:\s+(\S+)/)[1] + degrees = shell(%q[sensors | grep "#{options.device}:"]).match(/#{options.device}:\s+(\S+)/)[1] end {temp: degrees.to_f} end end