Skip to content

Instantly share code, notes, and snippets.

@liemle3893
Created April 6, 2020 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liemle3893/a30a9a951bf10d513a4dd330cddbc60b to your computer and use it in GitHub Desktop.
Save liemle3893/a30a9a951bf10d513a4dd330cddbc60b to your computer and use it in GitHub Desktop.
scrape_configs:
- job_name: 'consul_sd'
consul_sd_configs:
- server: '{{ env "NOMAD_IP_http"}}:8500'
services: []
relabel_configs:
- source_labels: [__meta_consul_service_metadata_prometheus_enable]
regex: true
action: keep
- source_labels: [__meta_consul_service_metadata_prometheus_path]
regex: (.+)
replacement: '${1}'
target_label: __metrics_path__
- source_labels: [__meta_consul_service_metadata_prometheus_address]
regex: (.+)
replacement: '${1}'
target_label: __address__
- source_labels: [__meta_consul_service]
target_label: job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment