Initial backup: 18 monitoring scripts + timers + docs

- 18 comprehensive monitoring checks
- 5 systemd timers (5min, 15min, hourly, daily, weekly)
- Complete documentation
- NTFY secure notification system
- Fixed debianvm disk space (91% to 57%)
- Fixed CloudReve integration
- Date: 2026-01-07
This commit is contained in:
PVE Monitoring System
2026-01-07 16:30:34 +08:00
commit 3a14fd2736
34 changed files with 1067 additions and 0 deletions

32
scripts/check-backups.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Check Proxmox backup job status
set -euo pipefail
SEND_NTFY="/usr/local/bin/send-ntfy.sh"
# Check for recent backup failures in task log
FAILED_BACKUPS=$(pvesh get /cluster/tasks --limit 50 2>/dev/null | grep -i backup | grep -i "TASK ERROR" || echo "")
if [ -n "$FAILED_BACKUPS" ]; then
FAIL_COUNT=$(echo "$FAILED_BACKUPS" | wc -l)
$SEND_NTFY critical "Backup Job Failed" "🔴 CRITICAL: $FAIL_COUNT backup job(s) failed recently!\nCheck PVE GUI for details." "skull,error,cd"
fi
# Check if backups are recent (check backup storage)
if [ -d "/mnt/pve/Fred/dump" ]; then
LATEST_BACKUP=$(find /mnt/pve/Fred/dump -name "*.vma.zst" -o -name "*.tar.zst" 2>/dev/null | sort | tail -1)
if [ -n "$LATEST_BACKUP" ]; then
BACKUP_AGE=$(stat -c %Y "$LATEST_BACKUP")
NOW=$(date +%s)
AGE_DAYS=$(( (NOW - BACKUP_AGE) / 86400 ))
if [ "$AGE_DAYS" -gt 7 ]; then
$SEND_NTFY warning "Backups Stale" "🟡 WARNING: No backup in $AGE_DAYS days! Last backup:\n$(basename $LATEST_BACKUP)" "warning,cd"
fi
else
$SEND_NTFY warning "No Backups Found" "🟡 WARNING: No backup files found in backup storage!" "warning,cd"
fi
fi
logger -t backup-monitor "Backup check completed"