From aaa341b6b2012596e1402abd153852af60b183c0 Mon Sep 17 00:00:00 2001 From: Jason O'Brien Date: Mon, 5 Oct 2026 01:16:45 -0500 Subject: [PATCH] monitor-all: read container IP from the host side (#17686) The CT check resolved the IP by running ip inside the guest via pct exec, which depends on the guest having it installed. If not, this always comes back empty, so the container is restarted every cycle despite answering ping. lxc-info reports the addresses from the host without running anything inside the guest. Fixes #17685 --- tools/pve/monitor-all.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/pve/monitor-all.sh b/tools/pve/monitor-all.sh index 650c86a8b..d1084aea4 100644 --- a/tools/pve/monitor-all.sh +++ b/tools/pve/monitor-all.sh @@ -110,8 +110,9 @@ while true; do pct start "$instance" >/dev/null 2>&1 continue fi - # Not every container names its interface eth0. - IP=$(pct exec "$instance" -- ip -4 -o addr show scope global 2>/dev/null | awk '{print $4}' | cut -d/ -f1 | head -n1) + # Read the IP from the host side; pct exec depends on tools inside the + # guest, which minimal/OCI images may lack. + IP=$(lxc-info -n "$instance" -iH 2>/dev/null | awk '/^[0-9.]+$/ && !/^(127|169\.254)\./ {print; exit}') if [ -z "$IP" ] || ! ping -c 1 -W 2 "$IP" >/dev/null 2>&1; then echo "$(date): CT $instance is not responding, restarting..." pct stop "$instance" >/dev/null 2>&1