Skip to content

sebastian13/zabbix-template-rescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Zabbix Template: Rescript Restic Backup

This script logs restic backup tasks to Zabbix, when using the rescript wrapper. It's capable of logging various output values of backup, check and forget & prune tasks.

Screenshots

Latest Data

Latest Data

Triggers

Triggers

Requirements

  • Restic
  • Rescript
  • Zabbix-Sender
  • python3
  • python3-pip
  • python3: humanfriendly

How to Use

  1. Download log-rescript.sh and rescript-repo-discovery.pl to /etc/zabbix/scripts/
mkdir -p /etc/zabbix/scripts
cd /etc/zabbix/scripts
curl -O https://raw.githubusercontent.com/sebastian13/zabbix-template-rescript/master/scripts/log-rescript.sh
curl -O https://github.com/sebastian13/zabbix-template-rescript/blob/master/scripts/rescript-repo-discovery.pl
chmod +x log-rescript.sh rescript-repo-discovery.pl
  1. Upload the template zbx_template_rescript-backup to Zabbix Server and assign it to a host

  2. Run the script after each rescript call

Examples

  • As simple as

     rescript reponame && /etc/zabbix/scripts/log-rescript.sh
  • Running as cronjob, I'm reccomending using chronic from moreutils

     26 3 * * * chronic rescript reponame && chronic /etc/zabbix/scripts/log-rescript.sh
  • Within a script

     #!/bin/bash
     
     set -e
     
     # Rescript's automatic function (https://gitlab.com/sulfuror/rescript.sh/wikis/usage)
     # reads the "LOGGING" variable. By default, the "LOGGING" variable is set to "yes".
     # This will create a log file with the output, which is necessary for this script.
     rescript example.repo.1
     # Run this script after each "rescript ..." call.
     source /etc/zabbix/scripts/log-rescript.sh
     
     # If using a rescript command, you have to use the logging flag -l or --log
     # to create a logfile, which is necessary fort his script.
     # -l, --log: create log file with command output.
     rescript example.repo.2 backup -l
     source /etc/zabbix/scripts/log-rescript.sh
     
     # This script will also log the output of a restic check.
     # -C, --check: check for errors in repository
     rescript example.repo.2 backup -lC
     source /etc/zabbix/scripts/log-rescript.sh
     

Adjust Triggers

  • A notification will be sent, if no snapshot id is received for >52h. The macro {$TRIGGER_NOBACKUPTIME} can be changed to any other timeframe. {$TRIGGER_NOBACKUPTIME_LVM} if using LVM Backup.

Rescript LVM Backup Monitoring

This template also enables monitoring of LVM backups via restic and rescript. Take a look at the lvm-restic-backup script for detailed instructions.

Releases

No releases published

Packages

No packages published