Files
mtusi2026lab3/scripts/lb-status.sh
T

7 lines
363 B
Bash
Executable File

#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
# HAProxy view of the api pool: slot, replica IP, state (2=UP, 0=DOWN), check result. Empty template slots are hidden.
docker compose --env-file .env exec -T lb sh -c \
"echo 'show servers state api' | nc 127.0.0.1 9999 | awk '\$1 !~ /^#/ && NF > 10 && \$5 != \"-\" {print \$4, \$5, (\$6 == 2 ? \"UP\" : \"DOWN\")}'"