bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-1.1.2 vs bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-1.1.3
- old
+ new
@@ -115,10 +115,14 @@
rescue RestClient::RequestTimeout
warning 'Connection timed out'
end
def master?
- state = get_es_resource('/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true')
+ state = if Gem::Version.new(acquire_es_version) >= Gem::Version.new('3.0.0')
+ get_es_resource('/_cluster/state/master_node')
+ else
+ get_es_resource('/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true')
+ 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