odyssey prometheus 監控
阿新 • • 發佈:2020-08-22
因為odyssey 相容pgbouncer,我們可以直接使用pgbouncer的exporter
環境準備
- docker-compose 檔案
version: "3"
services:
postgres:
image: postgres:12
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD=dalong"
pgbouncer:
image: brainsam/pgbouncer
ports:
- "6543:6543"
volumes:
- "./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini"
- "./users.txt:/opt/auth/users.txt"
app:
image: kksudo/odyssey-docker:1.1
ports:
- "6432:6432"
volumes:
- "./odyssey-dev.conf:/etc/odyssey/odyssey.conf"
prom1:
image: dalongrong/pgbouncer_exporter:v0.4.1
ports:
- "9127:9127"
command: --pgBouncer.connectionString="postgres://postgres:dalong@pgbouncer:6543/pgbouncer?sslmode=disable"
prom2:
image: dalongrong/pgbouncer_exporter:v0.4.1
ports:
- "9128:9127"
command: --pgBouncer.connectionString="postgres://postgres:dalong@app:6432/console?sslmode=disable"
- 效果
說明
pgbouncer的exporter 目前新版本的比較少,我基於原始碼構建提供了一個版本的容器映象
操作方法
git clone https://github.com/prometheus-community/pgbouncer_exporter.git
make build
Dockerfile
FROM debian:stretch-slim
COPY pgbouncer_exporter /bin/pgbouncer_exporter
ENTRYPOINT [ "/bin/pgbouncer_exporter" ]
參考資料
https://github.com/prometheus-community/pgbouncer_exporter
https://github.com/yandex/odyssey
https://github.com/rongfengliang/postgres-connect-pool-tools-learning