- 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
43 lines
1.5 KiB
Bash
Executable File
43 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Check network storage mounts (NFS/CIFS)
|
|
set -euo pipefail
|
|
|
|
SEND_NTFY="/usr/local/bin/send-ntfy.sh"
|
|
|
|
# Network mounts to check
|
|
MOUNTS=(
|
|
"/mnt/pve/Fred:NFS Fred (Backups)"
|
|
"/mnt/pve/iMacHDD:CIFS iMac"
|
|
)
|
|
|
|
for mount_config in "${MOUNTS[@]}"; do
|
|
IFS=':' read -r MOUNT_PATH MOUNT_NAME <<< "$mount_config"
|
|
|
|
# Check if mount point exists and is mounted
|
|
if ! mountpoint -q "$MOUNT_PATH" 2>/dev/null; then
|
|
$SEND_NTFY critical "Network Storage Down" "🔴 CRITICAL: $MOUNT_NAME not mounted at $MOUNT_PATH!" "skull,error,cd"
|
|
continue
|
|
fi
|
|
|
|
# Check if accessible (with timeout)
|
|
if ! timeout 5 ls "$MOUNT_PATH" >/dev/null 2>&1; then
|
|
$SEND_NTFY critical "Network Storage Stale" "🔴 CRITICAL: $MOUNT_NAME is STALE/FROZEN at $MOUNT_PATH (timeout)" "skull,error,cd"
|
|
continue
|
|
fi
|
|
|
|
# Check disk usage
|
|
DISK_INFO=$(df -h "$MOUNT_PATH" 2>/dev/null | tail -1)
|
|
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 "Network Storage Full" "🔴 CRITICAL: $MOUNT_NAME at ${USAGE}%\nUsed: $USED/$TOTAL, Free: $FREE" "cd,skull"
|
|
elif [ "$USAGE" -gt 80 ]; then
|
|
$SEND_NTFY warning "Network Storage High" "🟡 WARNING: $MOUNT_NAME at ${USAGE}%\nUsed: $USED/$TOTAL, Free: $FREE" "cd,warning"
|
|
fi
|
|
|
|
logger -t network-storage-monitor "$MOUNT_NAME: ${USAGE}% used"
|
|
done
|