Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
I’ve made a small set of scripts to allow for an easy monitoring integration with Nagios Core. You’ll need to place the following files into your nagios installation to set it up. I’ve tested this on Debian 10 (buster). Your Duplicati backup job needs to call the bash script by specifiying the advanced option “–run-script-after=/root/.config/Duplicati/save-job-result.sh” in order to save the job result to a status file. The status file will be read by the nagios plugin to determine the sensor status.
Current Version
1.0
Last Release Date
2021-07-17
Owner
pgn
Website
https://forum.duplicati.com/t/use-nagios-for-duplicati-monitoring
Download URL
License
Other
Compatible With
I’ve made a small set of scripts to allow for an easy monitoring integration with Nagios Core.
You’ll need to place the following files into your nagios installation to set it up. I’ve tested this on Debian 10 (buster). Your Duplicati backup job needs to call the bash script by specifiying the advanced option “–run-script-after=/root/.config/Duplicati/save-job-result.sh” in order to save the job result to a status file. The status file will be read by the nagios plugin to determine the sensor status.
chmod +x /usr/local/nagios/libexec/check_duplicati_job ******* START ******** #!/bin/sh # # Command line. ## sh /usr/local/nagios/libexec/check_duplicati_job my-test-backup-job; echo $? # EXIT_OK=0 EXIT_WARNING=1 EXIT_CRITICAL=2 # if [ -z "${1}" ]; then echo "WARNING: Duplicati job parameter #1 missing." exit ${EXIT_WARNING} fi DUPLICATI_JOB_NAME="${1}" DUPLICATI_JOB_RESULT_FULLFN="/root/.config/Duplicati/jobs/${DUPLICATI_JOB_NAME}.result" # if [ ! -f "${DUPLICATI_JOB_RESULT_FULLFN}" ]; then echo "WARNING: Job "${DUPLICATI_JOB_NAME}" was never executed." exit ${EXIT_WARNING} fi # if ( ! grep -q "Success" "${DUPLICATI_JOB_RESULT_FULLFN}" ); then echo "CRITICAL: Job "${DUPLICATI_JOB_NAME}" $(cat "${DUPLICATI_JOB_RESULT_FULLFN}" 2>/dev/null)" exit ${EXIT_CRITICAL} fi # echo "OK: Job "${DUPLICATI_JOB_NAME}" $(cat "${DUPLICATI_JOB_RESULT_FULLFN}" 2>/dev/null)" exit ${EXIT_OK} ******* END********
/usr/local/nagios/etc/commands/check_duplicati_job.cfg ******* START ******** define command{ command_name check_duplicati_job command_line $USER1$/check_duplicati_job $ARG1$ } ******* END********
/usr/local/nagios/etc/servers/my-duplicati-server.cfg ******* START ******** define host {
use linux-server host_name my-duplicati-server alias my-duplicati-server address [SERVER_IP_ADDRESS] check_period 24x7 contact_groups admins max_check_attempts 5 }
define service { use local-service host_name my-duplicati-server service_description duplicati-job-1 check_command check_duplicati_job!duplicati-job-1 } ******* END********
The job status saver: chmod +x /root/.config/Duplicati/save-job-result.sh ******* START ******** #!/bin/bash # # Store job result to file for nagios monitoring. SCRIPT_PATH="$(dirname "$(realpath "${0}")")" mkdir -p "${SCRIPT_PATH}/jobs/" echo "${DUPLICATI__PARSED_RESULT} ${DUPLICATI__EVENTNAME} ${DUPLICATI__OPERATIONNAME}" > "${SCRIPT_PATH}/jobs/${DUPLICATI__backup_name}.result" exit 0 ******* END********
You must be logged in to submit a review.
To:
From: