added notification support, and added to a few scripts . need to update the rest

This commit is contained in:
2026-04-08 21:42:56 -04:00
parent ae0054fd85
commit d12e034ef1
4 changed files with 260 additions and 3 deletions
+5 -2
View File
@@ -66,6 +66,7 @@ if [[ "$SHOW_STATUS" == true ]]; then
echo "$ICON_RETRY CPU fail limit: ${CPU_FAIL_LIMIT} strikes"
echo "$ICON_PING Resp fail limit: ${RESP_FAIL_LIMIT} strikes"
echo "$ICON_TIME Curl timeout: ${CURL_TIMEOUT}s"
echo "$ICON_NOTIFY Notifications: unRAID=${NOTIFY_UNRAID:-false} Discord=$([[ -n "${DISCORD_WEBHOOK:-}" ]] && echo enabled || echo disabled)"
echo "$ICON_GEAR Dry Run: $DRY_RUN"
echo "━━━━━━━━━━━━━━━━━━━━━━━"
exit 0
@@ -118,7 +119,7 @@ convert_to_mb() {
esac
}
# Restarts a container locally.
# Restarts a container locally and sends a notification.
# In dry run mode reports what would happen without acting.
restart_container() {
local container="$1" reason="$2"
@@ -131,9 +132,11 @@ restart_container() {
info "Restarting $container ($reason)..."
if docker restart "$container" >/dev/null 2>&1; then
echo "$ICON_STARTED $container restarted"
notify "$container restarted — $reason" "Docker Watchdog" "warning"
log "Restarted $container — reason: $reason"
else
error "Failed to restart $container"
notify "Failed to restart $container$reason" "Docker Watchdog" "alert"
fi
}
@@ -258,8 +261,8 @@ echo ""
echo "━━━ $ICON_WATCHDOG Watchdog Check — $(date '+%Y-%m-%d %H:%M:%S') ━━━"
echo ""
RESTARTED=()
SKIPPED=()
RESTARTED=0
START=$(date +%s)