Sha256: 319575d458a5c374341bfc2cddd03406540f432466dd9a0367db1c6d554389e1

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

require 'ganymed/collector'

module Ganymed
  class Collector
    class Load < Base
      def collect!
        return if not File.readable?('/proc/loadavg')
        File.open('/proc/loadavg') do |f|
          loadavg = f.read.chomp.split[0,3].map(&:to_f)
          @sampler.emit(:gauge, "os.loadavg", loadavg[0])
        end
      end

      def interval
        @config.interval.tap{} or 0.2
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ganymed-0.1.2 lib/ganymed/collector/load.rb
ganymed-0.1.1 lib/ganymed/collector/load.rb