fix: monitor-erik.sh — correct Erik SSH target + fix awk header skip

This commit is contained in:
Rene Fichtmueller 2026-04-21 00:34:28 +02:00
parent 9e6be570a3
commit f340482752

View File

@ -24,9 +24,9 @@
set -euo pipefail
# ── Config ───────────────────────────────────────────────────────────────────
TIP_API="${TIP_API:-https://tip.fichtmueller.org/api/health}"
TIP_API="${TIP_API:-https://transceiver-db.context-x.org/api/health}"
NTFY_TOPIC="${NTFY_TOPIC:-}" # e.g. "tip-erik-alerts"
SSH_TARGET="${SSH_TARGET:-erik-cf}" # SSH alias for Erik
SSH_TARGET="${SSH_TARGET:-root@82.165.222.127}" # Erik IONOS direct (Claudi key authorized)
LOAD_WARN="${LOAD_WARN:-4.0}" # 1m load warning threshold
DISK_WARN="${DISK_WARN:-85}" # disk % warning threshold
MEM_WARN="${MEM_WARN:-90}" # memory % warning threshold
@ -119,7 +119,7 @@ if ssh -o ConnectTimeout=10 -o BatchMode=yes "$SSH_TARGET" true 2>/dev/null; the
# Check restart counts (> 5 in the last run = likely crashing)
HIGH_RESTARTS=$(ssh -o ConnectTimeout=10 "$SSH_TARGET" \
"pm2 list --no-color 2>/dev/null | awk '{if(\$16 > 5) print \$2, \"restarts:\", \$16}'" \
"pm2 list --no-color 2>/dev/null | awk 'NR>3 && \$16~/^[0-9]+$/ && \$16+0 > 5 {print \$2, \"restarts:\", \$16}'" \
2>/dev/null || echo "")
if [[ -n "$HIGH_RESTARTS" ]]; then