bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-0.4.2 vs bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-0.4.3
- old
+ new
@@ -104,14 +104,14 @@
warning 'Connection timed out'
end
def master?
state = get_es_resource('/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true')
- if Gem::Version.new(acquire_es_version) >= Gem::Version.new('1.0.0')
- local = get_es_resource('/_nodes/_local')
- else
- local = get_es_resource('/_cluster/nodes/_local')
- end
+ local = if Gem::Version.new(acquire_es_version) >= Gem::Version.new('1.0.0')
+ get_es_resource('/_nodes/_local')
+ else
+ get_es_resource('/_cluster/nodes/_local')
+ end
local['nodes'].keys.first == state['master_node']
end
def acquire_health
health = get_es_resource('/_cluster/health').reject { |k, _v| %w(cluster_name timed_out).include?(k) }