Sha256: f29b4a35ac3252c212f345cd3337d48d49d2e3145f2948f47516ef5aecd0c033

Contents?: true

Size: 572 Bytes

Versions: 38

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

38 entries across 38 versions & 1 rubygems

Version Path
perus-1.0.5 lib/perus/pinger/metrics/temp.rb
perus-1.0.4 lib/perus/pinger/metrics/temp.rb
perus-1.0.3 lib/perus/pinger/metrics/temp.rb
perus-1.0.2 lib/perus/pinger/metrics/temp.rb
perus-1.0.1 lib/perus/pinger/metrics/temp.rb
perus-1.0.0 lib/perus/pinger/metrics/temp.rb
perus-0.1.35 lib/perus/pinger/metrics/temp.rb
perus-0.1.34 lib/perus/pinger/metrics/temp.rb
perus-0.1.33 lib/perus/pinger/metrics/temp.rb
perus-0.1.32 lib/perus/pinger/metrics/temp.rb
perus-0.1.31 lib/perus/pinger/metrics/temp.rb
perus-0.1.30 lib/perus/pinger/metrics/temp.rb
perus-0.1.29 lib/perus/pinger/metrics/temp.rb
perus-0.1.28 lib/perus/pinger/metrics/temp.rb
perus-0.1.27 lib/perus/pinger/metrics/temp.rb
perus-0.1.26 lib/perus/pinger/metrics/temp.rb
perus-0.1.25 lib/perus/pinger/metrics/temp.rb
perus-0.1.24 lib/perus/pinger/metrics/temp.rb
perus-0.1.23 lib/perus/pinger/metrics/temp.rb
perus-0.1.22 lib/perus/pinger/metrics/temp.rb