我可以通过Datadog REST API提取Datadog指标信息吗?

是否可以通过API针对特定指标从DataDog中提取标签信息?

我需要Metrics Explorer显示的相同信息(主机和标签列表),仅适用于一个指标。

我可以检索使用正则表达式模式过滤的标签:

def _load_metrics(from_time,filter_pattern: str):
    regex = re.compile(filter_pattern)
    all_metrics = api.Metric.list(from_time)['metrics']
    filtered = list(filter(regex.search,all_metrics))
    if not len(filtered):
        print('No metrics found with filter {}'.format(args.filter_pattern))
        return None
    print("Found {} metrics matching filter '{}'".format(len(filtered),args.filter_pattern))
    return filtered

我可以使用以下方法从度量标准中获取所有主机:

def get_hosts_from_tag(tag_name: str):
    hosts = api.Hosts.search(q='hosts:',filter='tag={}'.format(tag_name))
    for host in hosts['host_list']:
        print(host['name'])

使用datadogpyDataDog API如何从度量标准中获取所有标记?

谢谢

llf8282 回答:我可以通过Datadog REST API提取Datadog指标信息吗?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3073878.html

大家都在问