- Shell 100%
Really we need to implement proper sanitization... Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca> |
||
|---|---|---|
| .cspell | ||
| .vscode | ||
| files | ||
| .gitattributes | ||
| cspell.json | ||
| LICENSE | ||
| README.md | ||
| template_resticprofile_backup.yaml | ||
Zabbix and resticprofile or custom scripts for restic
Templates
I have created a set of Zabbix templates which identify the status files in a location and read each of them. These templates send an alert if a profile didn't successfully complete backup and/or a didn't finish a retention in the last 26 hours, or if a backup and/or if a retention failed. The maximum number of hours is configurable in a macro.
This version requires at least Zabbix 7.0
Original 5.x XML basis for the templates comes from https://github.com/creativeprojects/resticprofile/commits/master/contrib/zabbix although little of the original templates remain.
Macros
Five MACROs are available (really four, with last using two contexts)
{$RESTIC.STATUS_FILE.DIR}which contains the full path of the directory containing the status files. Default is/var/logfor non-OpenWrt versions, and/srv/logfor OpenWrt versions.{$RESTIC.STATUS_FILE.PREFIX}which is the prefix used for the status filename. Defaults toresticfor OpenWrt versions andresticprofilefor non-OpenWrt versions.{$RESTIC.STATUS_FILE.SUFFIX}which is the suffix used by the status filename. Defaultsresult.json{$RESTIC.HOURS_BETWEEN.MAX:"backup"}which contains the maximum number of hours before the template triggers an alert for missing backup. Default is26hours (for a backup running once a day, plus some time if it takes a bit longer than usual).{$RESTIC.HOURS_BETWEEN.MAX:"retention"}which contains the maximum number of hours before the template triggers an alert for missing retention. Default is26hours (for a backup & retention running once a day, plus some time if it takes a bit longer than usual).
The default status file for a profile named default is
/var/log/resticprofile-default-result.json
for non-OpenWrt, and
/srv/log/restic-default-result.json
for OpenWrt.
Custom scripts for OpenWrt
The files directory contains scriptlets intended to be sourced by the backup script(s) you use perform the actual backup and retention.
The files ending in -command are intended to be called by the other two
scriptlets.
The restic-backup-openwrt-with-result is intended to be sourced with the
necessary environment variables configured appropriately for your environment.
I backs up the same files as a sysupgrade would preserve. It additionally
includes up the directories you specify with RESTIC_ADDITIONAL_BACKUP_PATHS,
which defaults to /srv.
The restic-backup-psql-with-result uses restic-backup-openwrt-with-result to
do a complete backup of a PostgreSQL server running on the OpenWrt host.