From 30d42b7f48c8712963ede105cf832e65a3bf0217 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Wed, 9 Mar 2016 15:29:05 -0500 Subject: [PATCH] Add a cluster health indicator to the graph output This uses the ES health API to get the cluster health status and pretty it up in our index/gate graph pages. The cluster health API is documented here: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html Also add a note to the readme on how to view the openstack ES cluster health. Change-Id: I3df833cf5024af7282e2602e7dfa5db9c3384b6a --- README.rst | 10 +++++++--- elastic_recheck/cmd/graph.py | 4 ++++ web/share/elastic-recheck.js | 15 +++++++++++++++ web/share/gate.html | 1 + web/share/index.html | 1 + 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 7e25b25d..7f62c8b9 100644 --- a/README.rst +++ b/README.rst @@ -199,9 +199,10 @@ You can execute an individual query locally and analyze the search results:: Notes ----- -The html generation will generate links that work with Kibana3's logstash.json -dashboard. If you want the links to work properly on these generated files -you will need to host a Kibana3 with that dashboard. +* The html generation will generate links that work with Kibana3's + logstash.json dashboard. If you want the links to work properly on these + generated files you will need to host a Kibana3 with that dashboard. +* View the OpenStack ElasticSearch `cluster health here`_. Future Work ----------- @@ -215,3 +216,6 @@ Future Work - Move away from polling ElasticSearch to discover if its ready or not - Add nightly job to propose a patch to remove bug queries that return no hits -- Bug hasn't been seen in 2 weeks and must be closed + + +.. _cluster health here: http://logstash.openstack.org/elasticsearch/_cluster/health?pretty=true diff --git a/elastic_recheck/cmd/graph.py b/elastic_recheck/cmd/graph.py index 9aee62f1..7c03ef45 100755 --- a/elastic_recheck/cmd/graph.py +++ b/elastic_recheck/cmd/graph.py @@ -159,6 +159,10 @@ def main(): 'buglist': [] } + # Get the cluster health for the header + es = pyelasticsearch.ElasticSearch(es_url) + jsondata['status'] = es.health()['status'] + for query in classifier.queries: if args.queue: query['query'] = query['query'] + (' AND build_queue:%s' % diff --git a/web/share/elastic-recheck.js b/web/share/elastic-recheck.js index 7f569423..e43aed59 100644 --- a/web/share/elastic-recheck.js +++ b/web/share/elastic-recheck.js @@ -55,6 +55,20 @@ function update_critical_dates(data) { } } +function update_health(data) { + var health = $('#health'); + health.text(data['status']); + $('#health').text(data['status']); + if (data['status'] == 'red') { + // TODO(mriedem): link to the cluster health details + // http://logstash.openstack.org/elasticsearch/_cluster/health?pretty=true + health.css('font-weight', 'bold'); + } else { + health.css('font-weight', 'normal'); + } + health.css('color', data['status']); +} + function update() { var source = $("#bug-template").html(); var template = Handlebars.compile(source); @@ -64,6 +78,7 @@ function update() { if ('buglist' in data) { buglist = data['buglist']; update_critical_dates(data); + update_health(data); } var main = $('#main-container'); diff --git a/web/share/gate.html b/web/share/gate.html index 602f5b38..f3a4abbc 100644 --- a/web/share/gate.html +++ b/web/share/gate.html @@ -93,6 +93,7 @@ Data Last Updated:
Last Elastic Search Index Update:
Delay in Elastic Search:
+ Cluster Health:
diff --git a/web/share/index.html b/web/share/index.html index ce7c3c1e..b53a0d67 100644 --- a/web/share/index.html +++ b/web/share/index.html @@ -90,6 +90,7 @@ Data Last Updated:
Last Elastic Search Index Update:
Delay in Elastic Search:
+ Cluster Health: