Class: ProxES::MemoryStatusCheck
- Inherits:
-
StatusCheck
- Object
- Sequel::Model
- StatusCheck
- ProxES::MemoryStatusCheck
show all
- Defined in:
- lib/proxes/models/status_checks/memory_status_check.rb
Constant Summary
Constants inherited
from StatusCheck
StatusCheck::SOURCE_CALLS
Instance Method Summary
collapse
Methods inherited from StatusCheck
#passed?, #policy_class, #source_result, source_result, #validate
#client, #conn, #ssl_store
Instance Method Details
#check ⇒ Object
19
20
21
22
23
|
# File 'lib/proxes/models/status_checks/memory_status_check.rb', line 19
def check
return true if required_value.blank?
value < required_value.to_f
end
|
#children ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/proxes/models/status_checks/memory_status_check.rb', line 10
def children
@children ||= source_result['nodes']['nodes'].values.map do |node|
[
node['name'],
node['os']['mem']['used_percent'].to_f
]
end.to_h
end
|
25
26
27
|
# File 'lib/proxes/models/status_checks/memory_status_check.rb', line 25
def formatted(val = nil)
format('%.4f%% Average Usage', val || value)
end
|
#value ⇒ Object
5
6
7
8
|
# File 'lib/proxes/models/status_checks/memory_status_check.rb', line 5
def value
children.values.inject(0.0) { |sum, el| sum + el } / children.count
end
|