prometheus backup exporter is designed to monitor backups.
it gets backup sizes and stores them in the prometheus.
go get ./..
go build -o backup-exporter ./
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
just run
docker-compose build
docker-compose up -d
it will bring it up using docker compose file that is present here.