Class: ProxES::JVMHeapStatusCheck
- Inherits:
-
StatusCheck
- Object
- Sequel::Model
- StatusCheck
- ProxES::JVMHeapStatusCheck
show all
- Defined in:
- lib/proxes/models/status_checks/jvm_heap_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
18
19
20
21
22
|
# File 'lib/proxes/models/status_checks/jvm_heap_status_check.rb', line 18
def check
return true if required_value.blank?
value < required_value.to_f
end
|
#children ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/proxes/models/status_checks/jvm_heap_status_check.rb', line 9
def children
@children ||= source_result['nodes']['nodes'].values.map do |node|
[
node['name'],
node['jvm']['mem']['heap_used_percent'].to_f
]
end.to_h
end
|
24
25
26
|
# File 'lib/proxes/models/status_checks/jvm_heap_status_check.rb', line 24
def formatted(val = nil)
format('%.4f%% Average Usage', val || value)
end
|
#value ⇒ Object
5
6
7
|
# File 'lib/proxes/models/status_checks/jvm_heap_status_check.rb', line 5
def value
children.values.inject(0.0) { |sum, el| sum + el } / children.count
end
|