From d4c7b2fbd607c9f75d701f4a32abdac1ff7acf8b Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Sun, 30 Aug 2026 13:04:41 +0200 Subject: [PATCH] Report a failed move to the backup location as a failed backup to Zabbix dbbackup.backup.status carried ${exit_code}, which is the exit code of the dump alone - it is assigned right after the dump command and before the backup is moved to its destination. A dump that was written correctly but never reached its S3 bucket, filesystem path or blob container was therefore reported to Zabbix as a successful backup, and the template's only status trigger, last(/DB Backup4/dbbackup.backup.status.[{#NAME}])=1, stayed silent. The remaining items do not catch it either: size, filename and especially datetime are read from the dump in the temporary directory before the move, so even an age based fuzzytime() trigger sees a fresh backup while the destination holds nothing. Outside of Zabbix the failure is only visible in the container log and through dbbackup_notify, which does nothing unless NOTIFICATION_TYPE is configured - so a destination that silently stops accepting uploads can go unnoticed for a long time. Send the move result along with the dump result instead. The status stays 0 only when both the dump and the move succeeded, so the existing trigger fires without any change to the template. Verified with the container image against a stubbed zabbix_sender: an unreachable S3 endpoint now reports status 1 where the unpatched script reported 0, and a successful backup still reports 0. --- CHANGELOG.md | 8 ++++++++ rootfs/container/functions/10-dbbackup | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12bbd5f..abf67ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 4.9.3 2026-08-30 + + ### Changed + - Report a failed move to the backup location as a failed backup to Zabbix, so that the + `[{#NAME}] Backup - Failed with errors` trigger fires when a dump never reached its + destination + + ## 4.9.2 2026-08-24 ### Changed diff --git a/rootfs/container/functions/10-dbbackup b/rootfs/container/functions/10-dbbackup index 91ecaa6..99fa070 100644 --- a/rootfs/container/functions/10-dbbackup +++ b/rootfs/container/functions/10-dbbackup @@ -1630,10 +1630,15 @@ dbbackup_post_dbbackup() { silent dbbackup_run_as_user zabbix_sender -c "${ZABBIX_CONFIG_PATH}"/"${ZABBIX_CONFIG_FILE}" -k dbbackup.backup -o '[{"{#NAME}":"'${backup_job_db_host}.${backup_job_db_name}'"}]' local zabbix_payload=$(dbbackup_run_as_user mktemp) + ## The backup only counts as successful when it also reached its destination - + ## exit_code covers the dump alone, move_exit_code the move to the backup location. + local zabbix_status="${exit_code}" + if [ "${move_exit_code:-0}" != "0" ] ; then zabbix_status=1 ; fi + cat <