Sha256: 1ab834953a0bef4b2caca3c384d3560673734a221775c76d7b93781cde518fb3

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

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

            {temp: degrees.to_f}
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
perus-0.1.3 lib/perus/pinger/metrics/temp.rb