File tree Expand file tree Collapse file tree
elasticsearch/python_modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,12 +187,20 @@ def metric_init(params):
187187
188188 host = params .get ('host' , 'http://localhost:9200/' )
189189
190- version = params .get ('version' , '1.2' )
191-
190+ try :
191+ result = json .load (urllib .urlopen (host ))
192+ except (ValueError , IOError ):
193+ result = {}
194+
195+ host_version = result .get ('version' ,{}).get ('number' ) or "1.2"
196+ version = params .get ('version' , host_version )
197+
192198 m = re .match ('(?P<major>\d+)\.(?P<minor>(\d+(\.\d+)*))' , version )
193-
199+
194200 if m and m .group ('major' ) == '0' :
195201 url_cluster = '{0}_cluster/nodes/_local/stats?all=true' .format (host )
202+ elif m and m .group ('major' ) == '1' and m .group ('minor' ) == '3.2' :
203+ url_cluster = '{0}_nodes/_local/stats' .format (host )
196204 else :
197205 url_cluster = '{0}_cluster/state/nodes' .format (host )
198206
You can’t perform that action at this time.
0 commit comments