76 lines
2.2 KiB
Bash
Executable File
76 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${1:-http://127.0.0.1:8100}"
|
|
PYTHON_BIN="${PYTHON_BIN:-python3}"
|
|
|
|
echo "[1/5] health"
|
|
curl -fsS "${BASE_URL}/health"
|
|
echo
|
|
echo
|
|
|
|
echo "[2/5] runtime status"
|
|
STATUS_JSON="$(curl -fsS "${BASE_URL}/api/v1/runtime/status")"
|
|
echo "${STATUS_JSON}"
|
|
echo
|
|
echo
|
|
|
|
echo "[3/5] runtime cluster"
|
|
curl -fsS "${BASE_URL}/api/v1/runtime/cluster"
|
|
echo
|
|
echo
|
|
|
|
echo "[4/5] runtime readiness"
|
|
curl -fsS "${BASE_URL}/api/v1/runtime/readiness"
|
|
echo
|
|
echo
|
|
|
|
echo "[5/5] condensed summary"
|
|
"${PYTHON_BIN}" - <<'PY' "$STATUS_JSON"
|
|
import json
|
|
import sys
|
|
|
|
data = json.loads(sys.argv[1]).get("data", {})
|
|
node = data.get("node") or {}
|
|
worker = data.get("worker") or {}
|
|
sync_agent = data.get("sync_agent") or {}
|
|
detect = data.get("detect") or {}
|
|
cluster = data.get("cluster") or {}
|
|
summary = cluster.get("summary") or {}
|
|
|
|
print(
|
|
json.dumps(
|
|
{
|
|
"node": {
|
|
"code": node.get("code", ""),
|
|
"region": node.get("region", ""),
|
|
"role": node.get("role", ""),
|
|
},
|
|
"worker": {
|
|
"running": bool(worker.get("running", False)),
|
|
"expected_on_this_node": bool(worker.get("expected_on_this_node", True)),
|
|
"message": worker.get("message", ""),
|
|
},
|
|
"sync_agent": {
|
|
"running": bool(sync_agent.get("running", False)),
|
|
"expected_on_this_node": bool(sync_agent.get("expected_on_this_node", False)),
|
|
"message": sync_agent.get("message", ""),
|
|
},
|
|
"detect": {
|
|
"phase_label": detect.get("phase_label", ""),
|
|
"proxy_runtime_label": detect.get("proxy_runtime_label", ""),
|
|
"active_job": (detect.get("active_job") or {}).get("job_code", ""),
|
|
},
|
|
"cluster": {
|
|
"nodes_total": cluster.get("nodes_total", 0),
|
|
"online_control_nodes": summary.get("online_control_nodes", 0),
|
|
"online_worker_nodes": summary.get("online_worker_nodes", 0),
|
|
"dedicated_online_worker_nodes": summary.get("dedicated_online_worker_nodes", 0),
|
|
},
|
|
},
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
)
|
|
PY
|