release 1.7.5: monpages soft for stacks without public HTML
MONPAGES_REQUIRE_PUBLIC=0 turns missing public pages into WARN. FrancPaysan host-agent wrappers default to 0 until Infomaniak vhosts serve /monitoring*. GOA/koopa keep require=1.
This commit is contained in:
parent
06caa83d60
commit
909e6a65da
5 changed files with 33 additions and 13 deletions
|
|
@ -22,6 +22,9 @@ source "$ROOT/lib.sh"
|
|||
set_area monpages
|
||||
section "monpages · public monitoring HTML via FQDN (outside-in)"
|
||||
|
||||
# MONPAGES_REQUIRE_PUBLIC=0 → missing public pages are WARN (staging-only stacks / FP until vhost)
|
||||
: "${MONPAGES_REQUIRE_PUBLIC:=1}"
|
||||
|
||||
# Default hosts from domain (mirror run-host-report.sh)
|
||||
if [ -z "${MON_HOSTS:-}" ]; then
|
||||
case "${TALER_DOMAIN:-}" in
|
||||
|
|
@ -112,6 +115,17 @@ _is_bare_url() {
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
_mon_fail_or_soft() {
|
||||
local label="$1" detail="$2"
|
||||
if [ "${MONPAGES_REQUIRE_PUBLIC:-1}" != "1" ]; then
|
||||
warn "$label" "$detail (MONPAGES_REQUIRE_PUBLIC=0)"
|
||||
return 0
|
||||
fi
|
||||
fail "$label" "$detail"
|
||||
return 1
|
||||
}
|
||||
|
||||
check_one() {
|
||||
local url="$1"
|
||||
local body code hint soft=0
|
||||
|
|
@ -128,10 +142,10 @@ check_one() {
|
|||
rm -f "$body"
|
||||
return 0
|
||||
fi
|
||||
fail "public mon page missing" \
|
||||
"$url -> HTTP $code merchant/API JSON code 21 (Caddy handle not live — sudo ~/koopa-caddy/apply-monitoring-live.sh)"
|
||||
_mon_fail_or_soft "public mon page missing" \
|
||||
"$url -> HTTP $code merchant/API JSON code 21 (publish HTML + reverse-proxy handle /monitoring*)" || { rm -f "$body"; return 1; }
|
||||
rm -f "$body"
|
||||
return 1
|
||||
return 0
|
||||
fi
|
||||
if [ "$code" != "200" ]; then
|
||||
if [ "$soft" = "1" ]; then
|
||||
|
|
@ -139,9 +153,9 @@ check_one() {
|
|||
rm -f "$body"
|
||||
return 0
|
||||
fi
|
||||
fail "public mon page" "$url -> HTTP $code (want 200 HTML)"
|
||||
_mon_fail_or_soft "public mon page" "$url -> HTTP $code (want 200 HTML)" || { rm -f "$body"; return 1; }
|
||||
rm -f "$body"
|
||||
return 1
|
||||
return 0
|
||||
fi
|
||||
if is_monitoring_html "$body"; then
|
||||
if grep -qE 'sticky-bar|version-link' "$body" 2>/dev/null; then
|
||||
|
|
@ -153,9 +167,9 @@ check_one() {
|
|||
return 0
|
||||
fi
|
||||
hint=$(head -c 120 "$body" | tr '\n' ' ' | tr -cd '[:print:] ')
|
||||
fail "public mon page not monitoring HTML" "$url -> HTTP 200 body!=suite (${hint}...)"
|
||||
_mon_fail_or_soft "public mon page not monitoring HTML" "$url -> HTTP 200 body!=suite (${hint}...)" || { rm -f "$body"; return 1; }
|
||||
rm -f "$body"
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
URLS=()
|
||||
|
|
@ -206,8 +220,9 @@ for u in "${URLS[@]}"; do
|
|||
done
|
||||
|
||||
if [ "$ec" -ne 0 ]; then
|
||||
echo " hint: public pages down (merchant JSON code 21 = Caddy has no /monitoring* handles)"
|
||||
echo " fix on stack host: sudo ~/koopa-caddy/apply-monitoring-live.sh"
|
||||
echo " hint: public monitoring HTML not served (404 / merchant code 21)"
|
||||
echo " publish staging HTML + configure reverse-proxy/Caddy handle for /monitoring*"
|
||||
echo " (on koopa: sudo ~/koopa-caddy/apply-monitoring-live.sh)"
|
||||
# Staging vs public diagnosis (host-agent sets MONPAGES_STAGING_BASE / HTML_OUT)
|
||||
_stg="${MONPAGES_STAGING_BASE:-${HTML_OUT:-${HTML_BASE:-$HOME/monitoring-sites-staging}}}"
|
||||
_ok_dir="${HTML_OK_DIR:-monitoring}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue