Icinga2 check for Restic backup repositories. Checks if backups were run successfully and if repository state is okay.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Thomas Leister 16f2a6f01c Fix code listings to shell syntax 3 days ago
.gitignore First shot. Might work, but might also not work. Manually tested standalone only ... 3 days ago
LICENSE Initial commit 5 days ago
README.md Fix code listings to shell syntax 3 days ago
main.go First shot. Might work, but might also not work. Manually tested standalone only ... 3 days ago
mock.sh First shot. Might work, but might also not work. Manually tested standalone only ... 3 days ago

README.md

check_restic

Icinga2 check for Restic backup repositories. Checks if backups were run successfully and if repository state is okay.

How to install

Download

[…]

… or Compile

git clone ... 
cd check_restic
go build

Set permissions:

chmod u+x check_restic
chown root check_restic 
chmod u+s check_restic

How to use

As every Nagios-compatible check, you can run the check standalone:

./check_restic --command "/usr/local/bin/restic -r myrepo snapshots --quiet --host myhost --json --last"

How to configure in Icinga

[How to include into Icinga2]

Debugging

Make sure Restic is returning the JSON structure that we expect. Pick the command argument from above and run it in your shell directly:

/usr/local/bin/restic -r myrepo snapshots --quiet --host myhost --json --last

If this already fails:

  • Are all paths given as absolute paths?
  • Is the backup repository path correct?
  • Is the backup repository protected by a passphrase?
  • Are there any other options missing to Restic?

If the above restic command does work onk the command line, check if the permissions are right:

  • The owner of check_restic shoudl probably be set to root
  • The setuid bit (chmod u+s check_restic) must be set to run check_restic as root.

“Why was this implemented in Go and not as a (Python) script?”

”… why would you make things more complicated then necessary?!”

  1. I like Go.
  2. Go compiles to a single binary, which lets me do a setuid 0 (click) on it to run it as root in any case, even if the caller is another user (Restic probably should/needs to run as root, right?).
  3. Go compiles to a single binary, which takes a lot of dependency / versioning headaches from me.