From 7f2f39e56a877b79c60ef68fd597a7f25f899984 Mon Sep 17 00:00:00 2001 From: starsliao Date: Mon, 28 Nov 2022 09:18:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9prometheus=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E4=BC=98=E5=8C=96=E5=85=B3=E6=9C=BA=E7=9A=84?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=B8=8D=E6=8E=A5=E5=85=A5prometheus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask-consul/units/gen_config.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/flask-consul/units/gen_config.py b/flask-consul/units/gen_config.py index 389682c..738f7f7 100644 --- a/flask-consul/units/gen_config.py +++ b/flask-consul/units/gen_config.py @@ -28,8 +28,10 @@ def redis_config(region_list,cm_exporter,services_list,exporter): token: '{consul_token}' refresh_interval: 30s services: {services_list} - tags: ['ON'] relabel_configs: + - source_labels: [__meta_consul_tags] + regex: .*OFF.* + action: drop - source_labels: [__meta_consul_service_address,__meta_consul_service_port] regex: ([^:]+)(?::\d+)?;(\d+) target_label: __param_target @@ -97,8 +99,10 @@ def rds_config(region_list,cm_exporter,services_list,exporter): token: '{consul_token}' refresh_interval: 30s services: {services_list} - tags: ['ON'] relabel_configs: + - source_labels: [__meta_consul_tags] + regex: .*OFF.* + action: drop - source_labels: [__meta_consul_service_address,__meta_consul_service_port] regex: ([^:]+)(?::\d+)?;(\d+) target_label: __param_target @@ -157,8 +161,11 @@ def ecs_config(services_list,ostype_list): token: '{consul_token}' refresh_interval: 30s services: {services_list} - tags: ['{ostype}','ON'] + tags: ['{ostype}'] relabel_configs: + - source_labels: [__meta_consul_tags] + regex: .*OFF.* + action: drop - source_labels: ['__meta_consul_service'] target_label: cservice - source_labels: ['__meta_consul_service_metadata_vendor']