Skip to content

Commit

Permalink
修改prometheus的配置,优化关机的机器不接入prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
starsliao committed Nov 28, 2022
1 parent 88c1f3a commit 7f2f39e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions flask-consul/units/gen_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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']
Expand Down

0 comments on commit 7f2f39e

Please sign in to comment.