Add basic prometheus metrics for backup status.
This requires that prometheus-node-exporter
is installed.
If reportprom
is set, then during the reporting phase, metrics will be written
to ${prom_textfile_dir}/backupninja.prom
, which will then be available for
scraping by prometheus.
The metrics simply report the hostname and the number of actions run, the number of warnings, errors, fails, and halts that were produced in the backup run.
These are written to the prometheus-node-exporter directory in an atomic way.
# HELP backupninja_warnings Number of warnings reported by Backupninja
# TYPE backupninja_warnings gauge
# HELP backupninja_errors Number of errors reported by Backupninja
# TYPE backupninja_errors gauge
# HELP backupninja_fails Number of fails reported by Backupninja
# TYPE backupninja_fails gauge
# HELP backupninja_halts Number of halts reported by Backupninja
# TYPE backupninja_halts gauge
# HELP backupninja_actions Number of actions run by Backupninja
# TYPE backupninja_actions gauge
backupninja_warnings{host="$hostname"} $warnings
backupninja_errors{host="$hostname"} $errors
backupninja_fails{host="$hostname"} $fails
backupninja_halts{host="$hostname"} $halts
backupninja_actions{host="$hostname"} $actions_run
Exporting these metrics will let one configure alerts on backup failures.