bin/check-es-heap.rb in sensu-plugins-elasticsearch-0.0.1.alpha.2 vs bin/check-es-heap.rb in sensu-plugins-elasticsearch-0.0.1
- old
+ new
@@ -89,11 +89,11 @@
warning 'Connection timed out'
rescue JSON::ParserError
warning 'Elasticsearch API returned invalid JSON'
end
- def acquire_heap_data(return_max = false)
+ def acquire_heap_data(return_max = false) # rubocop:disable all
if Gem::Version.new(acquire_es_version) >= Gem::Version.new('1.0.0')
stats = acquire_es_resource('_nodes/_local/stats?jvm=true')
node = stats['nodes'].keys.first
else
stats = acquire_es_resource('_cluster/nodes/_local/stats?jvm=true')
@@ -108,10 +108,10 @@
rescue
warning 'Failed to obtain heap used in bytes'
end
end
- def run
+ def run # rubocop:disable all
if config[:percentage]
heap_used, heap_max = acquire_heap_data(true)
heap_used_ratio = ((100 * heap_used) / heap_max).to_i
message "Heap used in bytes #{heap_used} (#{heap_used_ratio}% full)"
if heap_used_ratio >= config[:crit]