[英]Prometheus config to ignore scraping of metrics for a specific namespace in Kubernetes
Is there a way to configure prometheus to ignore scraping metrics for all the resources belonging to a particular namespace?有没有办法将 prometheus 配置为忽略属于特定命名空间的所有资源的抓取指标? I am not able to figure it out by reading the documentation.我无法通过阅读文档来弄清楚。
You can drop targets with relabel_config
by using drop
action.您可以使用drop
操作使用relabel_config
删除目标。 From the documentation :从文档中:
drop
: Drop targets for whichregex
matches the concatenatedsource_labels
.drop
:删除regex
与串联的source_labels
匹配的目标。
Example:例子:
relabel_configs:
# This will ignore scraping targets from 'ignored_namespace_1',
# 'ignored_namespace_2', and 'ignored_namespace_N'.
- source_labels: [__meta_kubernetes_namespace]
action: drop
regex: ignored_namespace_1|ignored_namespace_2|ignored_namespace_N
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.