monitoring: stage.lefrancpaysan like hacktivism (inside+versions via stagepaysan)

Expand default phases for TESTPAYSAN to urls + inside + versions + e2e.
Inside/version/load use low-priv francpaysan-stage-user (stagepaysan)
and stage-lfp-* containers on 9030–9032; public stats.json stays outside-in.
This commit is contained in:
Hernâni Marques 2026-07-17 19:17:40 +02:00
parent eac6098b9f
commit 80d90f5857
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
7 changed files with 398 additions and 48 deletions

View file

@ -489,9 +489,9 @@ print(rep["summary"])
PY
}
# --- Taler stack load on koopa (host + bank/exchange/merchant) ---
# --- Taler stack load (host + bank/exchange/merchant) ---
# Writes JSON to $1. RAM, process counts, DB sizes, disk I/O counters.
# Uses KOOPA_SSH with fallback to KOOPA_SSH_FALLBACKS (koopa-external).
# koopa: KOOPA_SSH (+ fallbacks). stage-lfp: INSIDE_SSH (stagepaysan) + stage-lfp-* names.
metrics_taler_load() {
local out="${1:-$METRICS_DIR/load.json}"
local label="${2:-snap}"
@ -502,7 +502,20 @@ metrics_taler_load() {
fi
local raw=""
local remote_py
remote_py=$(cat <<'PY'
local _m_bank _m_mer _m_ex _m_ssh
_m_bank="taler-hacktivism-bank"
_m_mer="taler-hacktivism"
_m_ex="taler-hacktivism-exchange-ansible"
_m_ssh=""
if [ "${INSIDE_PROFILE:-}" = "stage-lfp" ] \
|| [ "${EXPECT_CURRENCY:-}" = "TESTPAYSAN" ] \
|| { [ -n "${INSIDE_SSH:-}" ] && [ "${LOCAL_STACK:-0}" != "1" ]; }; then
_m_bank="${INSIDE_BANK_CTR:-stage-lfp-bank}"
_m_mer="${INSIDE_MERCHANT_CTR:-stage-lfp-merchant}"
_m_ex="${INSIDE_EXCHANGE_CTR:-stage-lfp-exchange-ansible}"
_m_ssh="${INSIDE_SSH:-francpaysan-stage-user}"
fi
remote_py=$(cat <<PY
import base64, json, os, re, subprocess, time
from collections import defaultdict
@ -557,8 +570,12 @@ def disk_io():
return {"sectors_read": r, "sectors_written": w,
"approx_write_bytes": w*512, "approx_read_bytes": r*512}
CTRS = [("bank","taler-hacktivism-bank"),("merchant","taler-hacktivism"),
("exchange","taler-hacktivism-exchange-ansible")]
CTRS = [("bank","${_m_bank}"),("merchant","${_m_mer}"),
("exchange","${_m_ex}")]
PY
)
# Append the rest of the remote probe (quoted so shell does not expand)
remote_py+=$(cat <<'PY'
def running(name):
return sh(f"podman inspect -f '{{{{.State.Running}}}}' {name}").strip() == "true"
@ -715,19 +732,25 @@ print(json.dumps({
}))
PY
)
# Prefer SSH to koopa (LAN or koopa-external). Local podman only if we are on the host.
if [ "${SKIP_SSH:-0}" != "1" ] && type koopa_ssh_ok >/dev/null 2>&1 && koopa_ssh_ok; then
# Prefer stagepaysan (stage-lfp), else koopa SSH, else local podman only on LOCAL_STACK.
if [ -n "${_m_ssh}" ] && type mon_ssh_ok >/dev/null 2>&1 && mon_ssh_ok "${_m_ssh}"; then
raw=$(printf '%s' "$remote_py" | with_timeout "${METRICS_LOAD_SSH_TIMEOUT:-90}" \
ssh "${SSH_BASE_OPTS[@]}" "${_m_ssh}" python3 - 2>/dev/null || true)
elif [ "${SKIP_SSH:-0}" != "1" ] && type koopa_ssh_ok >/dev/null 2>&1 && koopa_ssh_ok; then
if type koopa_ssh_python >/dev/null 2>&1; then
raw=$(printf '%s' "$remote_py" | koopa_ssh_python "${METRICS_LOAD_SSH_TIMEOUT:-90}" 2>/dev/null || true)
else
raw=$(printf '%s' "$remote_py" | with_timeout "${METRICS_LOAD_SSH_TIMEOUT:-90}" \
ssh "${SSH_BASE_OPTS[@]}" "${KOOPA_SSH}" python3 - 2>/dev/null || true)
fi
elif command -v podman >/dev/null 2>&1; then
raw=$(python3 -c "$remote_py" 2>/dev/null || true)
elif [ "${LOCAL_STACK:-0}" = "1" ] && command -v podman >/dev/null 2>&1; then
raw=$(printf '%s' "$remote_py" | python3 - 2>/dev/null || true)
else
printf '%s\n' "{\"ok\":false,\"reason\":\"no-ssh-for-load\",\"label\":\"$label\"}" >"$out"
return 0
fi
if [ -z "$raw" ]; then
printf '%s\n' "{\"ok\":false,\"reason\":\"probe-failed\",\"label\":\"$label\",\"ssh\":\"${KOOPA_SSH:-?}\"}" >"$out"
printf '%s\n' "{\"ok\":false,\"reason\":\"probe-failed\",\"label\":\"$label\",\"ssh\":\"${_m_ssh:-${KOOPA_SSH:-?}}\"}" >"$out"
return 1
fi
printf '%s\n' "$raw" | python3 -c '