def request_metrics_data(args, uri):
# constructing URL to query metrics from
url = 'http://{host}:{port}/{uri}?json'.format(host=args.host, port=args.port, uri=uri)
# proceeding with query metrics
try:
r = requests.get(url, verify=False, allow_redirects=True)
except requests.ConnectionError as e:
print("Unable to connect to ", url, " error is ", e, file=sys.stderr)
return False
if r.status_code == 200:
# got HTTP/200 for request - storing it in cache
open(get_tmp_file_name(args, uri), mode="w").write(json.dumps(r.json()))
else:
return False
return True
impala-metrics-collector.py 文件源码
python
阅读 38
收藏 0
点赞 0
评论 0
评论列表
文章目录