Skip to content

Commit

Permalink
Collect db metrics using postgres_exporter
Browse files Browse the repository at this point in the history
- Fix checkpoints_timed not found error by using the `--no-collector.stat_bgwriter` flag in the docker compose command
  - This flag can be removed once the issue below is fixed, and a new docker image is released
  - prometheus-community/postgres_exporter#1060
- https://github.com/prometheus-community/postgres_exporter
- https://www.rockdata.net/external/postgres_exporter-metrics/
- https://stackoverflow.com/a/59366582
- https://hub.docker.com/r/prometheuscommunity/postgres-exporter
  • Loading branch information
High5Apps committed Oct 17, 2024
1 parent 2a2c9ad commit e16559e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compose.override.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ services:
environment:
SELF_SIGN: true
restart: "no"
metrics-db:
environment:
DATA_SOURCE_URI: db:5432/organize_development?sslmode=disable
site:
build:
target: dev
Expand Down
11 changes: 11 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ services:
restart: always
volumes:
- metrics-data:/prometheus:rw
metrics-db:
command: '--no-collector.stat_bgwriter'
depends_on:
- db
environment:
DATA_SOURCE_PASS: ${ORGANIZE_DATABASE_PASSWORD:?err}
DATA_SOURCE_URI: db:5432/organize_production?sslmode=disable
DATA_SOURCE_USER: postgres
image: prometheuscommunity/postgres-exporter:v0.15.0
ports:
- "127.0.0.1:9187:9187"
site:
build:
context: site
Expand Down
3 changes: 3 additions & 0 deletions metrics/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: postgres
static_configs:
- targets: ['metrics-db:9187']

0 comments on commit e16559e

Please sign in to comment.