[pve] Weekly backup 2026-07-26 — 7 files changed, 46 insertions(+), 77 deletions(-)

This commit is contained in:
Proxmox Backup
2026-07-26 03:00:04 -05:00
parent ca1d659ccf
commit 81a32ba67c
7 changed files with 46 additions and 77 deletions
+26 -19
View File
@@ -3,10 +3,10 @@
# status file, then pushes it to web.orbishosting.com (VM110).
set -u
CBB="/opt/local/MSP360 Backup/bin/cbb"
CBBV2="/opt/local/MSP360 Backup/bin/cbbV2"
SSHPW="Joker1974!!!"
OUT=/tmp/backup-status.json
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
BACKUP_ROOT=/mnt/nas-backups/MSPBackups
get_plan_status() {
# $1=host $2=user $3=planname $4=mode(local|hop)
@@ -23,20 +23,27 @@ get_plan_status() {
echo "${state:-unreachable}|${result:-unreachable}|${id:-}"
}
# Reads the destination generation folders on the NAS (mounted locally on
# PVE1) to find the last backup that actually completed and wrote data.
# More trustworthy than the plan's self-reported "Last result", since a
# plan can report Warning/Fail on a run after previously succeeding, and
# we want to know how stale the actual backed-up data is.
get_last_success() {
local nas_folder="$1" plan_id="$2" latest
# Fixed 2026-07-20: previously read CBB_Configuration/<planId>.cbb$/ generation
# folders on the NAS, assuming that was "more trustworthy" than the plan's own
# self-reported status. That folder turned out to only get written once, at
# initial plan setup/first test run, and never again on subsequent scheduled
# runs (even though those runs were genuinely succeeding daily and writing
# real file data elsewhere in the destination tree) - so every host showed a
# stale last_success frozen at its original setup date, making working daily
# backups look dead for weeks. The plan's own "Last run time" (from cbbV2
# plan details) reflects the actual most recent run and is accurate.
get_last_run_time() {
# $1=host $2=user $3=mode $4=plan_id
local host="$1" user="$2" mode="$3" plan_id="$4" out line
[ -z "$plan_id" ] && { echo "null"; return; }
latest=$(ls "$BACKUP_ROOT/$nas_folder/CBB_Configuration/${plan_id}.cbb\$/" 2>/dev/null | sort | tail -1)
if [ -z "$latest" ]; then
echo "null"
if [ "$mode" = "local" ]; then
out="$("$CBBV2" plan details -i "$plan_id" --progress 2>&1)"
else
date -u -d "${latest:0:4}-${latest:4:2}-${latest:6:2} ${latest:8:2}:${latest:10:2}:${latest:12:2}" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "null"
out="$(sshpass -p "$SSHPW" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=8 "$user@$host" "'$CBBV2' plan details -i $plan_id --progress 2>&1")"
fi
line=$(echo "$out" | grep '^Last run time:' | head -1 | sed 's/^Last run time: *//')
[ -z "$line" ] && { echo "null"; return; }
date -u -d "$line" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "null"
}
echo "[" > "$OUT"
@@ -57,14 +64,14 @@ EOF
}
collect() {
local name="$1" ip="$2" user="$3" mode="$4" nas_folder="$5"
local name="$1" ip="$2" user="$3" mode="$4"
local r state result id last_success
r=$(get_plan_status "$ip" "$user" "" "$mode")
state="${r%%|*}"
rest="${r#*|}"
result="${rest%%|*}"
id="${rest#*|}"
last_success=$(get_last_success "$nas_folder" "$id")
last_success=$(get_last_run_time "$ip" "$user" "$mode" "$id")
emit "$name" "$ip" "$state" "$result" "$last_success"
}
@@ -100,11 +107,11 @@ collect_proxmox_vm() {
fi
}
collect "PVE1" "10.48.200.90" "" "local" "CBB_pve"
collect "JARVIS" "10.48.200.211" "root" "hop" "CBB_JARVIS-211"
collect "NovaCPX" "10.48.200.110" "root" "hop" "CBB_NovaCPX-110"
collect "Jellyfin" "10.48.200.33" "root" "hop" "CBB_Jellyfin-33"
collect "MediaStack" "10.48.200.35" "root" "hop" "CBB_MediaStack-35"
collect "PVE1" "10.48.200.90" "" "local"
collect "JARVIS" "10.48.200.211" "root" "hop"
collect "NovaCPX" "10.48.200.110" "root" "hop"
collect "Jellyfin" "10.48.200.33" "root" "hop"
collect "MediaStack" "10.48.200.35" "root" "hop"
collect_proxmox_vm "Homebridge" "10.48.200.18" "118"
echo "]" >> "$OUT"