@cryptotaxi247 / netdata-1 / commits / 5cd0dd04b

elasticsearch plugin: small fixes

Ilya committed Jan 20, 2017 at 23:52 UTC 5cd0dd04bab147c2cc93a4ad80386d884b8eebb0
1 file changed +5 -6
python.d/elasticsearch.chart.py
+5 -6
@@ -224,7 +224,7 @@ class Service(UrlService):
224 (self._get_cluster_stats, url_cluster_stats)]
225
226 # Remove disabled API calls from 'avail methods'
227 - self.methods = [choice[0] for choice in list(zip(avail_methods, user_choice)) if choice[1]]
227 + self.methods = [avail_methods[_] for _ in range(len(avail_methods)) if user_choice[_]]
228
229 # Run _get_data for ALL active API calls.
230 api_result = {}
@@ -284,10 +284,9 @@ class Service(UrlService):
284
285 to_netdata = dict()
286 to_netdata.update(update_key('health', data))
287 - to_netdata['status_green'] = 1 if to_netdata.get('health_status') == 'green' else 0
288 - to_netdata['status_red'] = 1 if to_netdata.get('health_status') == 'red' else 0
289 - to_netdata['status_yellow'] = 1 if to_netdata.get('health_status') == 'yellow' else 0
290 - to_netdata['status_foo1'], to_netdata['status_foo2'], to_netdata['status_foo3'] = 0, 0, 0
287 + to_netdata.update({'status_green': 0, 'status_red': 0, 'status_yellow': 0,
288 + 'status_foo1': 0, 'status_foo2': 0, 'status_foo3': 0})
289 + to_netdata[''.join(['status_', to_netdata.get('health_status', '')])] = 1
290
291 queue.put(to_netdata)
292
@@ -360,7 +359,7 @@ class Service(UrlService):
359 queue.put(to_netdata)
360
361 def find_avg(self, value1, value2, key):
363 - if key not in self.latency.keys():
362 + if key not in self.latency:
363 self.latency.update({key: [value1, value2]})
364 return 0
365 else: