improve nomad scrape

This commit is contained in:
vincent 2022-05-14 09:33:04 +02:00
parent 9136e3f1bb
commit c254943855

View File

@ -59,6 +59,12 @@ scrape_configs:
consul_sd_configs: consul_sd_configs:
- server: 'consul.service.consul:8500' - server: 'consul.service.consul:8500'
relabel_configs: relabel_configs:
- source_labels: [__meta_consul_service_metadata_external_source]
regex: nomad
action: keep
- source_labels: [__meta_consul_service]
regex: nomad|nomad-client
action: drop
- source_labels: [__meta_consul_node] - source_labels: [__meta_consul_node]
target_label: __host__ target_label: __host__
- source_labels: [__meta_consul_service_metadata_external_source] - source_labels: [__meta_consul_service_metadata_external_source]
@ -69,10 +75,6 @@ scrape_configs:
regex: '_nomad-task-([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})-.*' regex: '_nomad-task-([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})-.*'
target_label: 'task_id' target_label: 'task_id'
replacement: '$1' replacement: '$1'
- source_labels: [__meta_consul_tags]
regex: ',(app|monitoring),'
target_label: 'group'
replacement: '$1'
- source_labels: [__meta_consul_service] - source_labels: [__meta_consul_service]
target_label: job target_label: job
- source_labels: ['__meta_consul_node'] - source_labels: ['__meta_consul_node']