Class: SrvMonitor::Scouts::LoadAverage
- Inherits:
-
SrvMonitor::Scout
- Object
- SrvMonitor::Scout
- SrvMonitor::Scouts::LoadAverage
- Extended by:
- Expectations::LoadAverage
- Defined in:
- lib/srvmonitor/scouts/load_average.rb
Constant Summary
Constants included from Expectations::LoadAverage
Expectations::LoadAverage::LOAD_AVERAGE_MAPPING
Instance Attribute Summary collapse
-
#load_average ⇒ Object
readonly
Returns the value of attribute load_average.
Attributes inherited from SrvMonitor::Scout
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options) ⇒ LoadAverage
constructor
Configure the scout with given options.
- #output ⇒ Object
Methods included from Expectations::LoadAverage
evaluate_load_average, extended
Methods inherited from SrvMonitor::Scout
expect, expectations, #local?, #options, #remote?, #run
Constructor Details
#initialize(options) ⇒ LoadAverage
Configure the scout with given options.
12 13 14 |
# File 'lib/srvmonitor/scouts/load_average.rb', line 12 def initialize() @server = [:server] end |
Instance Attribute Details
#load_average ⇒ Object (readonly)
Returns the value of attribute load_average.
8 9 10 |
# File 'lib/srvmonitor/scouts/load_average.rb', line 8 def load_average @load_average end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/srvmonitor/scouts/load_average.rb', line 16 def execute case when remote? then remote_exec when local? then local_exec end rescue @load_average = nil end |
#output ⇒ Object
25 26 27 28 29 |
# File 'lib/srvmonitor/scouts/load_average.rb', line 25 def output st = "#{@status}\tload: #{@load_average}" st = "[#{@server.name}]\t#{st}" st end |