Filippo Giunchedi has submitted this change and it was merged. Change subject: elasticsearch: better shard check output ......................................................................
elasticsearch: better shard check output previously icinga (or something in the middle) would strip single quotes, mangling the output, e.g. production-logstash-eqiad: {ustatus: uyellow, unumber_of_nodes: 3, uunassigned_shards: 1, utimed_out: False, uactive_primary_shards: 36, ucluster_name: uproduction-logstash-eqiad, urelocating_shards: 0, uactive_shards: 102, uinitializing_shards: 0, unumber_of_data_nodes: 3} Change-Id: Ibed17dde6e2e01e5613c5617654297c5ae55f684 --- M modules/elasticsearch/files/nagios/check_elasticsearch.py 1 file changed, 12 insertions(+), 2 deletions(-) Approvals: Filippo Giunchedi: Verified; Looks good to me, approved Ottomata: Looks good to me, approved diff --git a/modules/elasticsearch/files/nagios/check_elasticsearch.py b/modules/elasticsearch/files/nagios/check_elasticsearch.py index c2b017e..baa96fe 100644 --- a/modules/elasticsearch/files/nagios/check_elasticsearch.py +++ b/modules/elasticsearch/files/nagios/check_elasticsearch.py @@ -69,11 +69,20 @@ predicate, value, percent = m.groups() try: value = float(value) - except ValueError, e: + except ValueError: raise ValueError('unable to parse as float: %r' % value) self.predicate = self.PREDICATES.get(predicate, operator.eq) self.threshold = value self.percent = percent + + +def _format_health(health): + out = [] + for k, v in health.iteritems(): + health_item = '%s: %s' % (k.encode('utf8', 'ignore'), + v.encode('utf8', 'ignore')) + out.append(health_item) + return ', '.join(out) def check_status(health): @@ -145,7 +154,8 @@ if r != EX_OK: return r - log_ok('status %s: %r' % (cluster_health['cluster_name'], cluster_health)) + log_ok('status %s: %s' % (cluster_health['cluster_name'], + _format_health(cluster_health))) return EX_OK -- To view, visit https://gerrit.wikimedia.org/r/159261 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibed17dde6e2e01e5613c5617654297c5ae55f684 Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: Ottomata <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits