Class: Perus::Pinger::Temp
- Defined in:
- lib/perus/pinger/metrics/temp.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
abstract!, abstract?, #cleanup, #darwin?, description, human_name, inherited, #initialize, metric!, metric?, option, options, #shell, subclasses
Constructor Details
This class inherits a constructor from Perus::Pinger::Command
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/perus/pinger/metrics/temp.rb', line 8 def run if darwin? degrees = shell('istats cpu temp').split[2].match(/([0-9\.]+)/)[0] else degrees = shell(%Q[sensors | grep "#{.device}:"]).match(/#{.device}:\s+(\S+)/)[1] end {temp: degrees.to_f} end |