Created
September 3, 2020 11:12
-
-
Save dsouzajude/2dfd727449591d73b2c14ae0f14fa1d1 to your computer and use it in GitHub Desktop.
Prometheus Config with Consul SD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global: | |
| scrape_interval: 10s | |
| external_labels: | |
| Environment: sandbox | |
| Region: eu-west-1 | |
| Source: prometheus | |
| scrape_configs: | |
| - job_name: consul-services | |
| metrics_path: "/metrics" | |
| consul_sd_configs: | |
| - server: 127.0.0.1:8500 | |
| datacenter: eu-west-1 | |
| relabel_configs: | |
| # Filter in only proxy services | |
| # The "IsProxy" tag needs to be set for the Envoy Proxy Sidecar containers | |
| - source_labels: [__meta_consul_tags] | |
| regex: .*,IsProxy:yes,.* | |
| action: keep | |
| # Use the Consul's service name as the job name | |
| - source_labels: [__meta_consul_service] | |
| target_label: job | |
| # Replace the service's ports with the proxy's prometheus exposed port | |
| - source_labels: ['__address__'] | |
| separator: ':' | |
| regex: '(.*):(.*)' | |
| target_label: '__address__' | |
| replacement: '${1}:9102' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment