Class: Wary::Check::LoadAverage
- Inherits:
-
Object
- Object
- Wary::Check::LoadAverage
- Includes:
- Wary::Check
- Defined in:
- lib/wary/check/load_average.rb
Instance Attribute Summary
Attributes included from Wary::Check
Instance Method Summary collapse
-
#initialize(options) ⇒ LoadAverage
constructor
A new instance of LoadAverage.
- #status ⇒ Object
Methods included from Wary::Check
Constructor Details
#initialize(options) ⇒ LoadAverage
Returns a new instance of LoadAverage.
10 11 12 13 14 |
# File 'lib/wary/check/load_average.rb', line 10 def initialize() @load_meter = .fetch(:load_meter) { Wary::LoadMeter.new } @alert_threshold = .fetch(:alert_threshold) configure() end |
Instance Method Details
#status ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wary/check/load_average.rb', line 16 def status begin load = @load_meter.load rescue => e return failure(e.) end if load < @alert_threshold ok("Load #{load}") else alert("Load #{load} exceeds threshold (#{@alert_threshold})") end end |