Skip to content

abbas-gheydi/prometheus-backup-exporter

Repository files navigation

prometheus-backup-exporter

About The Project

prometheus backup exporter is designed to monitor backups.
it gets backup sizes and stores them in the prometheus.

How to build

go get ./..
go build -o backup-exporter ./

How to Use

edit config.yml:

Server:
  Port: 18083
DailyBackups:
  - "/home/ubuntu/backup/db/backend-db.sql"
  - "/home/ubuntu/tar/*.tar"
  - "/home/ubuntu/backup/constant.json"

here are some prometheus alert rules example:

  rules.yml: |
   groups:
   - name: example
     rules:
     - alert: backups size is wrong
       expr: (backup_size == 0) or (backup_size {backup!="_home_ubuntu_backup_constant_json"} <= backup_size offset 1d)
       for: 1m
       labels:
        severity: critical

     - alert: backups maybe failed
       expr: backup_date <= backup_date offset 1d
       for: 1m
       labels:
        severity: critical

Docker usage

just run

docker-compose build
docker-compose up -d

it will bring it up using docker compose file that is present here.