# add meta informations
curl -X PUT -d '{"id": "db004-hf","name": "node","address": "172.16.168.15","port": 9101,"tags": ["nodes","hf004"],"meta":{"idc":"hf"},"checks": [{"http": "http://172.16.168.15:9101/metrics", "interval": "5s"}]}' http://172.16.168.10:8500/v1/agent/service/register
scrape_configs:
- job_name: 'consul-node'
consul_sd_configs:
- server: '172.16.168.10:8500'
tags:
- "nodes"
refresh_interval: 3s
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*hf004.*
action: keep
- regex: __meta_consul_service_metadata_(.+)
action: labelmap
After restarting Prometheus, you can see that the label is automatically marked.