Backup Monitoring - coopdevs/handbook GitHub Wiki


⚠️ ATENCIÓ
Aquest handbook està descontinuat. La nova adreça és: https://handbook.coopdevs.org/ca/home

Pushing backup logs to Loki

1.- Install the monitoring_role from ansible

2.- Enable promtail and its module backups in host_vars config file.

monitoring_enabled: true

monitoring_promtail_enabled: true

monitoring_promtail_modules_enabled:

- backups

3.- Add (and encrypt) the Loki's credentials:

monitoring_loki_user: <int>

monitoring_loki_hostname: somewhere.lokihost.net

monitoring_loki_key: asgkD7agAKJAyAHAKJlaj9AJkjgOadA0DAD2AAsadajsfh3

4.- Run the playbook provision.yml.

Visualice data and create alerts in Grafana

The following query is valid for both dashboard and Grafana alerts.

count_over_time({job="backup"} |="Backup complete" [1d])<1

Dashboards

Stat & Time Series

Query:

count_over_time({job="backup"} |="Backup complete" [1d])<1
Alert

A - Query

Key Value
Rule Type Grafana managed alert
Datasource Loki
Timerange now-1d to now
Query count_over_time({job="backup"} |="Backup complete" [1d])
Query Type Range

B - Expression

Key Value
Operation Classic condition
Conditions WHEN count() OF A IS BELOW 1

Logs

Query:

({filename="/var/log/cron.d/restic-stdout.log",job="backup"})
⚠️ **GitHub.com Fallback** ⚠️