From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D14AD1FF183 for ; Wed, 24 Sep 2025 11:40:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 91446ABB; Wed, 24 Sep 2025 11:40:35 +0200 (CEST) Message-ID: <0c613244-24ea-4538-83b6-bc25e71a045d@proxmox.com> Date: Wed, 24 Sep 2025 11:40:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Constantin Herold , pve-devel@lists.proxmox.com References: <20250923174007.84121-1-proxmox8914@herold.me> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <20250923174007.84121-1-proxmox8914@herold.me> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758706817254 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.026 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [backuphook.sh, vzdump.pm] Subject: Re: [pve-devel] [PATCH pve-manager 0/1] feat: pass backup status to hook script on job-end/job-abort X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: Lukas Wagner Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 23.09.25 um 19:40 schrieb Constantin Herold: > I've been using the pve manager vzdump hook to do custom things after a backup is done e.g. backup some more files, call a webhook for monitoring, etc. > > However there is currently a big drawback, the job state does not get passed, so there is no way to tell whether the backup was succesfull or not. > > I recently had some drive issues which resulted in 1 vm backup failing, if i had not checked the mailnotification i would have never catched that. > > > e.g. /etc/vzdump.conf with `script: /root/backuphook.sh` > > cat << 'EOF' > /root/backuphook > #!/bin/bash > > cd /tmp > DATE=$(date +"%d.%m.%Y") > FILENAME="backup_$DATE.env" > echo "" >> "$FILENAME" > chmod 700 "$FILENAME" > echo "Arguments: $@" >> "$FILENAME" > printenv >> "$FILENAME" > echo -e "\n\n" >> "$FILENAME" > EOF > > > all the backuphook gets passed is the following: > ``` > Arguments: job-end > PWD=/tmp > LVM_SUPPRESS_FD_WARNINGS=1 > SHLVL=1 > STOREID=backup > LC_ALL=C > OLDPWD=/ > _=/usr/bin/printenv > ``` > > No way to tell whether the backup was succesfull, can't even grep the backup log for it etc. > > I've been using this simple patch to pass the errcount to the `job-end` and `job-abort` stage > > This way you can check now if it was succesfull or not, e.g: > > cat << 'EOF' > /root/backuphook > #!/bin/bash > > if [[ "$*" != *job-end* ]]; then > exit 0 > fi > > if [ "$ERRCOUNT" -gt 0 ]; then > # alert on broken backup (could be drive issues etc.) > # call webhook / trigger monitoring alert FWIW, for this the notification system might be better suited, it already has support for various targets, including web hooks. That doesn't mean adding info to the hook is not needed, just wanted to mention that it exist and that one option might be to provide support for trigger a dedicated notification for each single backup "sub-job", which would avoid the need for having a custom hook if it's just to get a dedicated notification / hook ASAP for each failed backup of a guest (vs. the overall result of the backups of all guests). > else > # do some more things after succesfull backup > fi > EOF > > > Would be great if this could be merged. > > Best regards > Constantin > > > Constantin Herold (1): > feat: pass backup status to hook script on job-end/job-abort > > PVE/VZDump.pm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel