- 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
21 lines
848 B
Bash
Executable File
21 lines
848 B
Bash
Executable File
#!/bin/bash
|
|
# Monitor Docker container restart counts
|
|
set -euo pipefail
|
|
|
|
SEND_NTFY="/usr/local/bin/send-ntfy.sh"
|
|
DEBIANVM_HOST="DEBIANVM"
|
|
|
|
# Get container restart counts
|
|
RESTART_INFO=$(timeout 15 sshpass -p 'admin' ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@$DEBIANVM_HOST "docker ps --format '{{.Names}}:{{.Status}}' | grep -E 'Restarting|\([1-9][0-9]*\)'" 2>/dev/null || echo "")
|
|
|
|
if [ -n "$RESTART_INFO" ]; then
|
|
while IFS= read -r line; do
|
|
CONTAINER=$(echo "$line" | cut -d':' -f1)
|
|
STATUS=$(echo "$line" | cut -d':' -f2-)
|
|
|
|
$SEND_NTFY warning "Container Restarting" "🟡 WARNING: Docker container '$CONTAINER' on debianvm is restarting\nStatus: $STATUS" "warning,package,arrows_counterclockwise"
|
|
done <<< "$RESTART_INFO"
|
|
fi
|
|
|
|
logger -t docker-restart-monitor "Docker restart check completed"
|