Restic / Resticprofile templates for Zabbix and restic shell scripts for OpenWrt - Official repository for these templates and scripts.
Find a file
Daniel F. Dickinson 7fa64da65a
Fix stderr echo when " in output
Really we need to implement proper sanitization...

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
2026-01-02 21:41:26 -05:00
.cspell Add OpenWrt restic backup scripts 2025-11-16 19:56:32 -05:00
.vscode Add initial commit 2025-11-15 13:09:55 -05:00
files Fix stderr echo when " in output 2026-01-02 21:41:26 -05:00
.gitattributes Add gitattributes for LF on all files 2025-11-17 16:38:13 -05:00
cspell.json Add workspace dictionary 2025-11-15 22:57:41 -05:00
LICENSE Add GPL-3 LICENSE file 2025-11-16 20:02:21 -05:00
README.md Fix another typo 2025-11-16 20:47:30 -05:00
template_resticprofile_backup.yaml Fix type of error field - it is a string 2025-11-16 23:40:46 -05:00

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)

  1. {$RESTIC.STATUS_FILE.DIR} which contains the full path of the directory containing the status files. Default is /var/log for non-OpenWrt versions, and /srv/log for OpenWrt versions.
  2. {$RESTIC.STATUS_FILE.PREFIX} which is the prefix used for the status filename. Defaults to restic for OpenWrt versions and resticprofile for non-OpenWrt versions.
  3. {$RESTIC.STATUS_FILE.SUFFIX} which is the suffix used by the status filename. Defaults result.json
  4. {$RESTIC.HOURS_BETWEEN.MAX:"backup"} which contains the maximum number of hours before the template triggers an alert for missing backup. Default is 26 hours (for a backup running once a day, plus some time if it takes a bit longer than usual).
  5. {$RESTIC.HOURS_BETWEEN.MAX:"retention"} which contains the maximum number of hours before the template triggers an alert for missing retention. Default is 26 hours (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.