From ce03c9ebdacef3066e04236d71787b87223cd247 Mon Sep 17 00:00:00 2001 From: Aaron Sterr Date: Mon, 12 Dec 2016 09:35:13 +0900 Subject: [PATCH 1/2] Removed unused parameter from get_metrics for indices_stats_url See: https://github.com/elastic/elasticsearch/issues/21410 The all=true parameter is no longer supported, and causes the HTTP GET to return: $ curl 'http://ny2-laa-005:9200/_stats?all=true' {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/_stats] contains unrecognized parameter: [all]"}],"type":"illegal_argument_exception","reason":"request [/_stats] contains unrecognized parameter: [all]"},"status":400} This causes the es2graphite.py to throw this stack trace and continuously retry: 2016-12-12 09:31:08,006 [MainThread] [INFO ] 2016-12-12 09:31:06: GET http://ny2-laa-005:9200/_stats?all=true 2016-12-12 09:31:08,352 [MainThread] [ERROR ] Traceback+%28most+recent+call+last%29%3A%0A++File+%22.%2Fes2graphite.py%22%2C+line+328%2C+in+%3Cmodule%3E%0A++++get_metrics%28%29%0A++File+%22.%2Fes2graphite.py%22%2C+line+34%2C+in+timed%0A++++result+%3D+method%28%2Aargs%2C+%2A%2Akw%29%0A++File+%22.%2Fes2graphite.py%22%2C+line+274%2C+in+get_metrics%0A++++indices_stats_data+%3D+urllib2.urlopen%28indices_stats_url%29.read%28%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+154%2C+in+urlopen%0A++++return+opener.open%28url%2C+data%2C+timeout%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+437%2C+in+open%0A++++response+%3D+meth%28req%2C+response%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+550%2C+in+http_response%0A++++%27http%27%2C+request%2C+response%2C+code%2C+msg%2C+hdrs%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+475%2C+in+error%0A++++return+self._call_chain%28%2Aargs%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+409%2C+in+_call_chain%0A++++result+%3D+func%28%2Aargs%29%0A++File+%22%2FSystem%2FLibrary%2FFrameworks%2FPython.framework%2FVersions%2F2.7%2Flib%2Fpython2.7%2Furllib2.py%22%2C+line+558%2C+in+http_error_default%0A++++raise+HTTPError%28req.get_full_url%28%29%2C+code%2C+msg%2C+hdrs%2C+fp%29%0AHTTPError%3A+HTTP+Error+400%3A+Bad+Request%0A --- es2graphite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/es2graphite.py b/es2graphite.py index f9f5788..fe2a834 100755 --- a/es2graphite.py +++ b/es2graphite.py @@ -265,7 +265,7 @@ def get_metrics(): thread_pool_metrics = process_thread_pool(args.prefix, thread_pool, cluster_health['cluster_name']) submit_to_graphite(thread_pool_metrics) - indices_stats_url = 'http://%s/_stats?all=true' % get_es_host() + indices_stats_url = 'http://%s/_stats' % get_es_host() if args.shard_stats: indices_stats_url = '%s&level=shards' % indices_stats_url elif args.health_level == 'cluster': From 3fcd5356674bdc892507b184f8af5ff8bd256538 Mon Sep 17 00:00:00 2001 From: Aaron Sterr Date: Thu, 15 Dec 2016 15:05:08 +0900 Subject: [PATCH 2/2] need to use python2.7 --- es2graphite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/es2graphite.py b/es2graphite.py index fe2a834..c6f5425 100755 --- a/es2graphite.py +++ b/es2graphite.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.7 import re import sys