90 lines
2.9 KiB
Bash
Executable File
90 lines
2.9 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/7] health"
|
|
curl -fsS "${BASE_URL}/health"
|
|
echo
|
|
echo
|
|
|
|
echo "[2/7] runtime readiness"
|
|
curl -fsS "${BASE_URL}/api/v1/runtime/readiness"
|
|
echo
|
|
echo
|
|
|
|
echo "[3/7] runtime cluster"
|
|
curl -fsS "${BASE_URL}/api/v1/runtime/cluster"
|
|
echo
|
|
echo
|
|
|
|
echo "[4/7] runtime sync summary"
|
|
curl -fsS "${BASE_URL}/api/v1/runtime/sync-summary"
|
|
echo
|
|
echo
|
|
|
|
echo "[5/7] detect status"
|
|
curl -fsS "${BASE_URL}/api/v1/detect/status"
|
|
echo
|
|
echo
|
|
|
|
echo "[6/7] active detect job"
|
|
curl -fsS "${BASE_URL}/api/v1/detect/job/active"
|
|
echo
|
|
echo
|
|
|
|
echo "[7/7] condensed summary"
|
|
READINESS_JSON="$(curl -fsS "${BASE_URL}/api/v1/runtime/readiness")"
|
|
SYNC_JSON="$(curl -fsS "${BASE_URL}/api/v1/runtime/sync-summary")"
|
|
CLUSTER_JSON="$(curl -fsS "${BASE_URL}/api/v1/runtime/cluster")"
|
|
"${PYTHON_BIN}" - <<'PY' "$READINESS_JSON" "$SYNC_JSON" "$CLUSTER_JSON"
|
|
import json
|
|
import sys
|
|
|
|
readiness = json.loads(sys.argv[1]).get("data", {})
|
|
sync = json.loads(sys.argv[2]).get("data", {})
|
|
cluster = json.loads(sys.argv[3]).get("data", {})
|
|
batches = (sync.get("detect_result_batches") or {})
|
|
states = batches.get("state_counts") or {}
|
|
summary = cluster.get("summary") or {}
|
|
print(
|
|
json.dumps(
|
|
{
|
|
"readiness": {
|
|
"status": readiness.get("status"),
|
|
"ready": bool(readiness.get("ready", False)),
|
|
"summary": readiness.get("summary", ""),
|
|
},
|
|
"cluster": {
|
|
"online_control_nodes": summary.get("online_control_nodes", 0),
|
|
"online_worker_nodes": summary.get("online_worker_nodes", 0),
|
|
"busy_nodes": summary.get("busy_nodes", []),
|
|
"stale_nodes": summary.get("stale_nodes", []),
|
|
"offline_nodes": summary.get("offline_nodes", []),
|
|
},
|
|
"sync": {
|
|
"enabled": bool(sync.get("enabled", False)),
|
|
"source_region": sync.get("source_region"),
|
|
"target_region": sync.get("target_region"),
|
|
"runtime_projection": (sync.get("type_counts") or {}).get("runtime_projection", 0),
|
|
"detect_result_projection": (sync.get("type_counts") or {}).get("detect_result_projection", 0),
|
|
"runtime_ingest": (sync.get("type_counts") or {}).get("runtime_ingest", 0),
|
|
"detect_result_ingest": (sync.get("type_counts") or {}).get("detect_result_ingest", 0),
|
|
},
|
|
"detect_result_batches": {
|
|
"jobs_total": batches.get("jobs_total", 0),
|
|
"synced": states.get("synced", 0),
|
|
"delivered": states.get("delivered", 0),
|
|
"pushing": states.get("pushing", 0),
|
|
"projected": states.get("projected", 0),
|
|
"failed": states.get("failed", 0),
|
|
"unsynced": states.get("unsynced", 0),
|
|
},
|
|
},
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
)
|
|
PY
|