Sha256: acfd004057cb68c57a70fa49ab0a3039c77f76ed8d96d36004cd3000296a7b29

Contents?: true

Size: 417 Bytes

Versions: 5

Compression:

Stored size: 417 Bytes

Contents

class Eye::Checker::Cpu < Eye::Checker

  # checks :cpu, :every => 3.seconds, :below => 80, :times => [3,5]

  param :below, [Fixnum, Float], true

  def check_name
    "cpu(#{human_value(below)})"
  end

  def get_value
    Eye::SystemResources.cpu(@pid).to_i # nil => 0
  end

  def human_value(value)
    "#{value}%"
  end

  def good?(value)
    if below
      value < below
    else
      true
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eye-0.2.3 lib/eye/checker/cpu.rb
eye-0.2.2 lib/eye/checker/cpu.rb
eye-0.2.1 lib/eye/checker/cpu.rb
eye-0.2 lib/eye/checker/cpu.rb
eye-0.1.11 lib/eye/checker/cpu.rb