1
0
mirror of https://github.com/pavel-v-sobolev/pg_probackup_exporter.git synced 2025-09-16 09:36:22 +02:00
2025-04-10 20:13:46 +03:00
2025-04-09 19:05:23 +03:00
2025-04-09 19:06:53 +03:00
2025-04-10 20:13:46 +03:00

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

  1. download pg_probackup_exporter.py and put to your folder. E.g. /usr/local/bin
  2. install python flask library. For ubuntu: sudo apt install python3-flask
  3. 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:

  1. path to your pg_probackup executable e.g. PG_PROBACKUP_COMMAND = '/usr/bin/pg_probackup-17'
  2. web service port, default 9899 PG_PROBACKUP_EXPORTER_PORT = '9899'
  3. 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"

Description
No description provided
Readme GPL-3.0 44 KiB
Languages
Python 100%