mirror of
https://github.com/myronblair/proxmox-config
synced 2026-07-27 12:53:39 -05:00
[pve] Weekly backup 2026-07-26 — 7 files changed, 46 insertions(+), 77 deletions(-)
This commit is contained in:
@@ -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"
|
||||
|
||||
+2
-2
@@ -1,5 +1,4 @@
|
||||
vzdump: backup-aa6b1890-23c0
|
||||
schedule 21:00
|
||||
all 1
|
||||
compress zstd
|
||||
enabled 1
|
||||
@@ -8,6 +7,7 @@ vzdump: backup-aa6b1890-23c0
|
||||
node pve
|
||||
notes-template {{guestname}}
|
||||
notification-mode notification-system
|
||||
prune-backups keep-daily=7,keep-last=3,keep-monthly=1,keep-weekly=1,keep-yearly=1
|
||||
prune-backups keep-daily=5,keep-last=3,keep-monthly=1,keep-weekly=1,keep-yearly=1
|
||||
schedule 21:00
|
||||
storage SynologyProx
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
arch: amd64
|
||||
cores: 8
|
||||
dev0: /dev/net/tun
|
||||
features: nesting=1,keyctl=1,mount=nfs;cifs
|
||||
hostname: StreamHoard
|
||||
memory: 12288
|
||||
mp0: /mnt/nas-video,mp=/mnt/nas/video
|
||||
mp1: /mnt/nas-backups,mp=/mnt/nas-backups
|
||||
nameserver: 1.1.1.1
|
||||
net0: name=eth0,bridge=vmbr0,gw=10.48.200.1,hwaddr=BC:24:11:47:D1:14,ip=10.48.200.104/24,type=veth
|
||||
onboot: 1
|
||||
ostype: debian
|
||||
rootfs: local-lvm:vm-104-disk-0,size=60G
|
||||
searchdomain: orbishosting.com
|
||||
startup: order=10,up=30
|
||||
swap: 512
|
||||
unprivileged: 1
|
||||
@@ -1,15 +0,0 @@
|
||||
arch: amd64
|
||||
cores: 2
|
||||
features: nesting=1,keyctl=1
|
||||
hostname: WireGuard-67
|
||||
memory: 4096
|
||||
nameserver: 10.48.200.90
|
||||
net0: name=eth0,bridge=vmbr0,gw=10.48.200.1,hwaddr=BC:24:11:46:1E:70,ip=10.48.200.67/24,type=veth
|
||||
onboot: 1
|
||||
ostype: alpine
|
||||
rootfs: SynologyLVM:vm-110-disk-0,size=8G
|
||||
swap: 512
|
||||
timezone: America/Chicago
|
||||
unprivileged: 1
|
||||
lxc.cgroup2.devices.allow: c 10:200 rwm
|
||||
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
|
||||
@@ -2,6 +2,7 @@ boot: order=ide0;ide2;net0
|
||||
cores: 2
|
||||
cpu: host
|
||||
ide0: SynologyLVM:vm-102-disk-0,size=50G
|
||||
ide1: SynologyLVM:vm-102-disk-1,size=1000G
|
||||
ide2: SynologyProx:iso/WinServ2019.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso,media=cdrom,size=5519618K
|
||||
machine: pc-q35-11.0+pve2
|
||||
memory: 16384
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
agent: enabled=1
|
||||
boot: order=scsi0
|
||||
cipassword: $5$tLqUKTpU$CYpX9cKbAdJ8JwaimzUUrcrPqwLvkm69PERl8AtvQg8
|
||||
ciuser: root
|
||||
cores: 4
|
||||
ipconfig0: ip=10.48.200.35/24,gw=10.48.200.1
|
||||
machine: q35
|
||||
memory: 16384
|
||||
meta: creation-qemu=11.0.0,ctime=1780635620
|
||||
name: MediaStack-35
|
||||
nameserver: 10.48.200.90
|
||||
net0: virtio=BC:24:11:84:40:0E,bridge=vmbr0
|
||||
onboot: 1
|
||||
ostype: l26
|
||||
scsi0: SynologyLVM:vm-103-disk-0,discard=on,size=50G
|
||||
scsihw: virtio-scsi-pci
|
||||
smbios1: uuid=48b8e543-f0bb-49a3-857f-90603379193a
|
||||
sshkeys: ssh-rsa%20AAAAB3NzaC1yc2EAAAADAQABAAACAQDNYf4z78s4%2BK4HoiUiHoqPbCCEFngCAXKP7mGwhCAc86TTbAosTpAnG1HycPzb2s2B3K3geQPUzQzcLvWdBX8hJM8IamvAZ%2FWXPtOszWTuVnaYM6BQY7ldIdXi3a%2BxscWr%2BM8dM6OexXqdCAy66HXmgl98%2BCg2uEbxCFelH81%2F5d3cuoCXllpvUawyYZe5UjFjPeBpPc%2FQyhDxG4ovYYpcCeHbzLXc9jIfawjwJTDcYfeXVHFisMdSUp0%2BeXndRM1TybeSOfT4oQbuijdsy4IQo0md5fRYgZuXxHMIgy7obNB3OPf9szgbWTEWK6jNFhkQHIZXPSRxSM9L1a0RkarQk%2BxqTf96wTJL%2FUz6hSyImYjhtPvcOoBRejaQaK96HuWGe3At96%2BI6WjvJNEDM%2FjF9tosp2nbdhcGRitYmxREdv7M8AYM393MKT94BBrulr6tI504%2B0dDTH7IaojYc8SBAtu1TrUwinLA9zQ35Ney5Ry%2FMr7tNOLU1Ni3lkqNRWysEjWxEizM%2F1sK7u2fbAzx3kE%2BTRpyzmFv6gSiGHqjs5j%2FtG6daK7Hv6OvbHSWwV%2FpW6CKslJWFAsa5tVv%2BFw8cXdcMMyb6%2FCYTUtcFMgcF0hhtsd1g6YfnOWRGLcUxFe9odiayhMlstne%2FdqeyvQCjStrzOxUT5ta9L9JZifDkQ%3D%3D%20root%40pve%0A
|
||||
vmgenid: ebe24bf0-94b7-4ba5-a207-c709c360c2fa
|
||||
@@ -1,22 +0,0 @@
|
||||
agent: 1
|
||||
boot: order=scsi0
|
||||
cipassword: $5$XnJRY7/D$aqDdg7nCNwAoNv2qhwxbn4awlik1g3LslC3ckCxWCcD
|
||||
ciuser: root
|
||||
cores: 2
|
||||
ide2: SynologyLVM:vm-112-cloudinit,media=cdrom,size=4M
|
||||
ipconfig0: ip=10.48.200.33/24,gw=10.48.200.1
|
||||
machine: q35
|
||||
memory: 4096
|
||||
meta: creation-qemu=11.0.0,ctime=1782570362
|
||||
name: Jellyfin-33
|
||||
nameserver: 10.48.200.90
|
||||
net0: virtio=BC:24:11:B9:CD:D9,bridge=vmbr0
|
||||
onboot: 1
|
||||
ostype: l26
|
||||
scsi0: SynologyLVM:vm-112-disk-0,discard=on,iothread=1,size=50G
|
||||
scsihw: virtio-scsi-single
|
||||
searchdomain: local
|
||||
smbios1: uuid=5bed9e81-9d6d-4195-8129-60ed9c44b6c5
|
||||
sockets: 2
|
||||
sshkeys: ssh-rsa%20AAAAB3NzaC1yc2EAAAADAQABAAACAQDNYf4z78s4%2BK4HoiUiHoqPbCCEFngCAXKP7mGwhCAc86TTbAosTpAnG1HycPzb2s2B3K3geQPUzQzcLvWdBX8hJM8IamvAZ%2FWXPtOszWTuVnaYM6BQY7ldIdXi3a%2BxscWr%2BM8dM6OexXqdCAy66HXmgl98%2BCg2uEbxCFelH81%2F5d3cuoCXllpvUawyYZe5UjFjPeBpPc%2FQyhDxG4ovYYpcCeHbzLXc9jIfawjwJTDcYfeXVHFisMdSUp0%2BeXndRM1TybeSOfT4oQbuijdsy4IQo0md5fRYgZuXxHMIgy7obNB3OPf9szgbWTEWK6jNFhkQHIZXPSRxSM9L1a0RkarQk%2BxqTf96wTJL%2FUz6hSyImYjhtPvcOoBRejaQaK96HuWGe3At96%2BI6WjvJNEDM%2FjF9tosp2nbdhcGRitYmxREdv7M8AYM393MKT94BBrulr6tI504%2B0dDTH7IaojYc8SBAtu1TrUwinLA9zQ35Ney5Ry%2FMr7tNOLU1Ni3lkqNRWysEjWxEizM%2F1sK7u2fbAzx3kE%2BTRpyzmFv6gSiGHqjs5j%2FtG6daK7Hv6OvbHSWwV%2FpW6CKslJWFAsa5tVv%2BFw8cXdcMMyb6%2FCYTUtcFMgcF0hhtsd1g6YfnOWRGLcUxFe9odiayhMlstne%2FdqeyvQCjStrzOxUT5ta9L9JZifDkQ%3D%3D%20root%40pve%0A
|
||||
vmgenid: 893ec4e4-8314-4546-8fce-1588e18b84ce
|
||||
Reference in New Issue
Block a user