maxim-mityutko / borgmatic-exporter

Prometheus exporter for Borgmatic seamlessly integrated into official Borgmatic docker image
MIT License
2 stars 2 forks source link
backup borgmatic docker exporter grafana prometheus prometheus-exporter

Borgmatic Exporter

Super-Linter GitHub last commit (branch) Static Badge

Borgmatic Exporter seamlessly integrates Prometheus metrics and Borgmatic. This project is based on the borg-exporter by @danihodovic, however it introduces a few changes:

Metrics

Name Type
borg_total_backups Gauge
borg_total_chunks Gauge
borg_total_size Gauge
borg_total_compressed_size Gauge
borg_total_deduplicated_size Gauge
borg_total_deduplicated_compressed_size Gauge
borg_last_backup_timestamp Gauge

Installation

Docker

Recommended way of using Borgmatic Exporter is through Docker. The image is based on the official docker-borgmatic image, and it seamlessly integrates Prometheus metrics into the distribution by running both Borgmatic entrypoint and exporter server in parallel. All images are available here.

docker pull ghcr.io/maxim-mityutko/borgmatic-exporter:latest
  1. Configure Borgmatic: https://github.com/borgmatic-collective/docker-borgmatic/blob/master/README.md
  2. Configure Borgmatic Exporter:

    Borgmatic Exporter supports the following environment variables for customization:

    Name Description Default
    BORGMATIC_CONFIG One or multiple references to Borgmatic configuration files /etc/borgmatic.d/config.yml
    BORGMATIC_EXPORTER_PORT Port for the metrics server 9996
    BORGMATIC_EXPORTER_TIME Display time each Borgmatic call takes false

    NOTE: Use colon (:) if multiple configs should be provided through the environment variable BORGMATIC_CONFIG, e.g. /etc/borgmatic/config_1.yml:/etc/borgmatic/config_2.yml

Local

Install and configure borgmatic by following the instructions in the official repository, then install Borgmatic Exporter

git clone https://github.com/maxim-mityutko/borgmatic-exporter.git
pip install -Ur requirements.txt
python3 cli.py run -c <path-to-your-borgmatic-config-yml>

Observability and Monitoring

Grafana

dashboard.png Dashboard is available in the repo or on Grafana's Dashboard Library.

Alerts

Alerting rules can be found here. By default alert will be triggered if there is no backup for repository within 25 hours.

Development

Local Environment

Docker