Skip to content

Commit e16559e

Browse files
committed
Collect db metrics using postgres_exporter
- 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
1 parent 2a2c9ad commit e16559e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

compose.override.dev.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ services:
99
environment:
1010
SELF_SIGN: true
1111
restart: "no"
12+
metrics-db:
13+
environment:
14+
DATA_SOURCE_URI: db:5432/organize_development?sslmode=disable
1215
site:
1316
build:
1417
target: dev

compose.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ services:
4141
restart: always
4242
volumes:
4343
- metrics-data:/prometheus:rw
44+
metrics-db:
45+
command: '--no-collector.stat_bgwriter'
46+
depends_on:
47+
- db
48+
environment:
49+
DATA_SOURCE_PASS: ${ORGANIZE_DATABASE_PASSWORD:?err}
50+
DATA_SOURCE_URI: db:5432/organize_production?sslmode=disable
51+
DATA_SOURCE_USER: postgres
52+
image: prometheuscommunity/postgres-exporter:v0.15.0
53+
ports:
54+
- "127.0.0.1:9187:9187"
4455
site:
4556
build:
4657
context: site

metrics/prometheus.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ scrape_configs:
22
- job_name: prometheus
33
static_configs:
44
- targets: ['localhost:9090']
5+
- job_name: postgres
6+
static_configs:
7+
- targets: ['metrics-db:9187']

0 commit comments

Comments
 (0)