impala-metrics-collector.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:zoomdata-tools 作者: Zoomdata 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号