Sha256: a9c0935fe57b1f2bab3a0cf967a3f7f7cdae6954a52f31a61c3657b2f73e1926

Contents?: true

Size: 399 Bytes

Versions: 2

Compression:

Stored size: 399 Bytes

Contents

require 'ganymed/collector'

module Ganymed
  class Collector
    class Uptime < Base
      def collect!
        return if not File.readable?('/proc/stat')
        File.open('/proc/stat').each do |line|
          next if not line =~ /^btime /
          boottime = Time.at(line.chomp.split[1].to_i)
          @processor.event("os.reboot", 1, :now => boottime)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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