31ed4e2f99
Converts the cdp-relay-health-monitor from inline SSH (nested quoting bugs) to a proper self-contained script on bl. Uses pinned ports from netvm-names.sh as single source of truth. New files/actions: - bin/relay-health-check.sh: checks all four CDP relays, exits 0/1 - box-ctl.py relay-health: JSON wrapper for the Box CLI Session: sidechat/chromebox-ops
27 lines
869 B
Bash
Executable File
27 lines
869 B
Bash
Executable File
#!/bin/bash
|
|
# relay-health-check.sh — check all four CDP relay endpoints on bl.
|
|
# Self-contained: no nested SSH quoting. Sources pinned ports from netvm-names.sh.
|
|
#
|
|
# Output: "name:code" per relay on stdout.
|
|
# Exit 0 if all return 200; exit 1 otherwise (lists failures on stderr).
|
|
#
|
|
# Called by the cdp-relay-health-monitor cron and by `box-ctl.py relay-health`.
|
|
|
|
set -u
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=/dev/null
|
|
source "$SCRIPT_DIR/netvm-names.sh"
|
|
|
|
FAILED=0
|
|
for node in muse pip 646 opm; do
|
|
netvm_names "$node"
|
|
url="http://${PEER_IP}:${CDP_PORT}/json/version"
|
|
code=$(curl -s -m 8 -o /dev/null -w "%{http_code}" "$url" 2>/dev/null || echo "000")
|
|
echo "${node}:${code}"
|
|
if [ "$code" != "200" ]; then
|
|
echo "FAIL: ${node} relay ${PEER_IP}:${CDP_PORT} returned ${code}" >&2
|
|
FAILED=1
|
|
fi
|
|
done
|
|
exit $FAILED
|