Created
February 18, 2022 07:33
-
-
Save v0112358/aec2f996126298e46607b0e4a8b439ed to your computer and use it in GitHub Desktop.
Prometheus-Consul-Postgres.yml
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: gcp | |
Source: prometheus | |
scrape_configs: | |
- job_name: consul-services | |
metrics_path: "/metrics" | |
consul_sd_configs: | |
- server: 127.0.0.1:8500 | |
datacenter: gcp | |
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: .*,postgresql_server,.* | |
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}:9187' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment