mirror of
https://github.com/pavel-v-sobolev/pg_probackup_exporter.git
synced 2025-09-16 09:36:22 +02:00
main
pg_probackup_exporter
Postgres pg_probackup prometheus metrics exporter. This is a tool for monitoring postgresql backups. It exports pg_probackup metrics as a web service in prometheus format.
Installation
- download pg_probackup_exporter.py and put to your folder. E.g. /usr/local/bin
- install python flask library. For ubuntu: sudo apt install python3-flask
- set environment variables and run the program with the following command: python3 /usr/local/bin/pg_probackup_exporter.py
You need to set 3 environment vars:
- path to your pg_probackup executable e.g. PG_PROBACKUP_COMMAND = '/usr/bin/pg_probackup-17'
- web service port, default 9899 PG_PROBACKUP_EXPORTER_PORT = '9899'
- path to backup folder e.g. PG_PROBACKUP_PATH = '/mnt/backup'
Metrics are available under http://your_host:port/metrics
Example service file for ubuntu linux:
sudo nano /etc/systemd/system/pg_probackup_exporter.service
[Service] Type=simple User=postgres Group=postgres Environment=PG_PROBACKUP_COMMAND='/usr/bin/pg_probackup-17' Environment=PG_PROBACKUP_PATH='/mnt/backup' ExecStart=/usr/bin/python3 /usr/local/bin/pg_probackup_exporter.py KillMode=control-group TimeoutSec=5 Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target
Example for prometheus config
scrape_configs: - job_name: pg_probackup scrape_interval: 30s scrape_timeout: 30s scheme: http static_configs: - targets: ["your_host:9899"] labels: "service": "postgres" "instance": "your_host" "host": "your_host" "Business_Critical": "Medium" "Team": "Postgres"
Languages
Python
100%