我的 Prometheus 服务器从 Consul 获取它的目标列表(或“服务”,在 Consul 的行话中)。我只想监控这些目标的一个子集。这应该可以通过 Prometheus 的 regex 机制实现,但正确的配置让我望而却步。这是怎么做的?
最佳答案
我在网上搜索过,没有一个例子显示它是如何完成的,所以为了后代 - 以下配置将删除所有标有“ignore-at-prometheus”标签的领事服务
# ignore consul services with 'ignore_at_prometheus' tag
# https://www.robustperception.io/little-things-matter/
relabel_configs:
- source_labels: ['__meta_consul_tags']
regex: '(.*),ignore-at-prometheus,(.*)'
action: drop
关于consul - Prometheus:如何根据 Consul 标签删除目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40376937/