@cryptotaxi247 / netdata-1 / commits / 76edc9542

elasticsearch plugin: cluster health status chart added

Ilya committed Jan 20, 2017 at 15:52 UTC 76edc95420ee6bc8c91d4b70a7d687df31e71715
1 file changed +16 -1
python.d/elasticsearch.chart.py
+16 -1
@@ -20,7 +20,7 @@ retries = 60
20 # charts order (can be overridden if you want less charts, or different order)
21 ORDER = ['search_perf_total', 'search_perf_time', 'search_latency', 'index_perf_total', 'index_perf_time',
22 'index_latency', 'jvm_mem_heap', 'jvm_gc_count', 'jvm_gc_time', 'thread_pool_qr', 'fdata_cache',
23 - 'fdata_ev_tr', 'cluster_health_nodes', 'cluster_health_shards', 'cluster_stats_nodes',
23 + 'fdata_ev_tr', 'cluster_health_status', 'cluster_health_nodes', 'cluster_health_shards', 'cluster_stats_nodes',
24 'cluster_stats_query_cache', 'cluster_stats_docs', 'cluster_stats_store', 'cluster_stats_indices_shards']
25
26 CHARTS = {
@@ -121,6 +121,17 @@ CHARTS = {
121 ["health_number_of_pending_tasks", 'pending_tasks', 'absolute'],
122 ["health_number_of_in_flight_fetch", 'inflight_fetch', 'absolute']
123 ]},
124 + 'cluster_health_status': {
125 + 'options': [None, 'Cluster status', 'status', 'Cluster health API',
126 + 'es.cluster_health_status', 'area'],
127 + 'lines': [
128 + ["status_green", 'green', 'absolute'],
129 + ["status_red", 'red', 'absolute'],
130 + ["status_foo1", None, 'absolute'],
131 + ["status_foo2", None, 'absolute'],
132 + ["status_foo3", None, 'absolute'],
133 + ["status_yellow", 'yellow', 'absolute']
134 + ]},
135 'cluster_health_shards': {
136 'options': [None, 'Shards statistics', 'shards', 'Cluster health API',
137 'es.cluster_health_sharts', 'stacked'],
@@ -273,6 +284,10 @@ 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
291
292 queue.put(to_netdata)
293