标签:class source component rom nbsp reg keep The 动态
一 Prometheus
1. 通过relabeling可以在写入metrics数据之前,动态修改metrics的label
relabel_configs:
- source_labels: [__meta_ec2_tag_Environment, __meta_ec2_tag_prometheus_sd_component]
separator: ‘:‘
regex: ‘(^(lab-test|lab-access):kafka$)|(^(lab-test|lab-access):kafka\|.*)|(^(lab-test|lab-access):.*\|kafka$)|(^(lab-test|lab-access):.*\|kafka\|.*)‘
action: keep
- source_labels: [__meta_ec2_tag_Name,__meta_ec2_instance_id]
separator: ‘:‘
regex: ‘(.*):(.*)‘
replacement: ‘${1} (${2})‘
target_label: instance
- source_labels: [__meta_ec2_tag_Environment]
target_label: environment
- source_labels: [__meta_ec2_vpc_id]
target_label: vpc_id
- source_labels: [__meta_ec2_tag_prometheus_sd_component]
target_label: component
replacement: kafka
2. 通过relabeling可以对Target实例进行过滤和选择
标签:class source component rom nbsp reg keep The 动态
原文地址:https://www.cnblogs.com/sylvia-lesson/p/10188751.html