diff --git a/elasticsearch_collectd.py b/elasticsearch_collectd.py index 3dd2392..05f8b02 100755 --- a/elasticsearch_collectd.py +++ b/elasticsearch_collectd.py @@ -993,10 +993,14 @@ def load_es_info(self): node_info = json['nodes'].itervalues().next() version = node_info['version'] # a node is master eligible by default unless it's configured otherwise + # Note: settings is deprecated from json starting ES 5.5 master_eligible = True - if 'node' in node_info['settings'] and \ - 'master' in node_info['settings']['node']: - master_eligible = node_info['settings']['node']['master'] == 'true' + try: + if 'node' in node_info['settings'] and \ + 'master' in node_info['settings']['node']: + master_eligible = node_info['settings']['node']['master'] == 'true' + except KeyError: + pass # update settings self.es_master_eligible = master_eligible