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:
37
scripts/check-all-vm-disks.sh
Executable file
37
scripts/check-all-vm-disks.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Check disk usage on all VMs via SSH
|
||||
set -euo pipefail
|
||||
|
||||
SEND_NTFY="/usr/local/bin/send-ntfy.sh"
|
||||
|
||||
# VM configurations: "VMID:NAME:IP"
|
||||
VMS=(
|
||||
"101:debianvm:DEBIANVM"
|
||||
"282:ubuntu-server-xfce:ubuntu-server-xfce"
|
||||
"100:haos14.0:haos14"
|
||||
)
|
||||
|
||||
for vm_config in "${VMS[@]}"; do
|
||||
IFS=':' read -r VMID NAME HOST <<< "$vm_config"
|
||||
|
||||
# Try to SSH and get disk usage
|
||||
DISK_INFO=$(timeout 10 sshpass -p 'admin' ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@$HOST "df -h / 2>/dev/null | tail -1" 2>/dev/null || echo "FAILED")
|
||||
|
||||
if [ "$DISK_INFO" = "FAILED" ]; then
|
||||
$SEND_NTFY warning "VM Disk Check Failed" "🟡 WARNING: Cannot check disk on $NAME (VMID $VMID) - SSH failed" "warning,computer"
|
||||
continue
|
||||
fi
|
||||
|
||||
USAGE=$(echo "$DISK_INFO" | awk '{print $5}' | sed 's/%//')
|
||||
USED=$(echo "$DISK_INFO" | awk '{print $3}')
|
||||
TOTAL=$(echo "$DISK_INFO" | awk '{print $2}')
|
||||
FREE=$(echo "$DISK_INFO" | awk '{print $4}')
|
||||
|
||||
if [ "$USAGE" -gt 90 ]; then
|
||||
$SEND_NTFY critical "VM Disk Critical" "🔴 CRITICAL: $NAME (VMID $VMID) root partition at ${USAGE}%\nUsed: $USED/$TOTAL, Free: $FREE" "cd,skull,computer"
|
||||
elif [ "$USAGE" -gt 80 ]; then
|
||||
$SEND_NTFY warning "VM Disk Warning" "🟡 WARNING: $NAME (VMID $VMID) root partition at ${USAGE}%\nUsed: $USED/$TOTAL, Free: $FREE" "cd,warning,computer"
|
||||
fi
|
||||
|
||||
logger -t vm-disk-monitor "$NAME (VMID $VMID): ${USAGE}%"
|
||||
done
|
||||
Reference in New Issue
Block a user