-
-
Save tung1404/7848b61266f94b8a564c387e7ec9f21e to your computer and use it in GitHub Desktop.
How to monitor PostgreSQL with Prometheus and Grafana | Docker
This file contains 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
version: "3.9" | |
services: | |
grafana: | |
image: grafana/grafana | |
ports: | |
- 3000:3000 | |
prometheus: | |
image: prom/prometheus | |
ports: | |
- 9090:9090 | |
volumes: | |
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro | |
postgres: | |
image: postgres:12 | |
ports: | |
- 5432:5432 | |
volumes: | |
- ./backup:/var/lib/postgresql/data | |
environment: | |
POSTGRES_PASSWORD: postgrespassword | |
POSTGRES_DB: shop | |
postgres-exporter: | |
image: prometheuscommunity/postgres-exporter | |
ports: | |
- 9187:9187 | |
environment: | |
DATA_SOURCE_NAME: "postgresql://postgres:postgrespassword@postgres:5432/shop?sslmode=disable" | |
links: | |
- postgres | |
- prometheus | |
This file contains 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: 15s | |
evaluation_interval: 15s | |
scrape_configs: | |
- job_name: prometheus | |
static_configs: | |
- targets: ["localhost:9090"] | |
- job_name: postgres-exporter | |
static_configs: | |
- targets: ["postgres-exporter:9187"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment