chris2k20 / check_borgmatic

Python3 Nagios/Icinga2 plugin for borgmatic to check the last successful backup (Borgbackup)
MIT License
0 stars 6 forks source link

UNKOWN - can not get data from borgmatic! #1

Open Banzai292 opened 3 years ago

Banzai292 commented 3 years ago

Hello,

This message comes when querying via NRPE from the Nagios server.

nagios-server$>/usr/local/nagios/libexec/check_nrpe -H mdtreplicat.moderndrive.com -c check_borgmatic
UNKOWN - can not get data from borgmatic!

The call on the client (with or without sudo):

client$>/usr/lib/nagios/plugins/check_borgmatic.py -w 86400 -c 185400
CRITICAL - last borgmatic backup: 2021-03-19 11:36:52 (age: 6 ....

Other NRPE calls work:

nagios-server$>/usr/local/nagios/libexec/check_nrpe -H mdtreplicat.moderndrive.com -c check_disk
DISK OK - free space: /var/tmp 557199 MB (61% inode=99 ....

nrpe.cfg:

:
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/md2
command[check_borgmatic]=/usr/lib/nagios/plugins/check_borgmatic.py
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20% -c 10%
:

A change to:

:
command[check_borgmatic]=/usr/bin/sudo /usr/lib/nagios/plugins/check_borgmatic.py
:

results in

NRPE: Unable to read output

/etc/sudoers.d/nagios_borgmatic: nagios ALL= NOPASSWD:/usr/local/bin/borgmatic --list --successful --last 1 --json

I also tried the --nagios option with no success!

chris2k20 commented 3 years ago

Hi,

thanks for your feedback. And Sorry for the Late Reply..

Anyway, the check_borgmatic seems to run as it should in your local shell. In the output it says "Critical" last backup is 6 days old, so borgmatic can read the data?!

client$>/usr/lib/nagios/plugins/check_borgmatic.py -w 86400 -c 185400
CRITICAL - **last borgmatic backup: 2021-03-19 11:36:52** (age: 6 ....

Which OS is running on your client? Debian/Ubuntu/CentOS?

Can you please run sudo borgmatic --list --successful --last 1 --json with your nagios user on the client and post the output?

Best regards, Chris