monitoring: clearer severity colours with #NNN lines
This commit is contained in:
parent
57b4014ccc
commit
7c5ed2887c
2 changed files with 40 additions and 32 deletions
|
|
@ -61,7 +61,9 @@ Each check prints **global** and **grouped** ids:
|
||||||
|
|
||||||
- `#014` — run-wide counter (whole `./taler-monitoring.sh` invocation)
|
- `#014` — run-wide counter (whole `./taler-monitoring.sh` invocation)
|
||||||
- `www.exchange-03` — area.group-NN
|
- `www.exchange-03` — area.group-NN
|
||||||
- **WARN** badge = **yellow**; **ERROR** = **red** only
|
- **Colours (left badge + label):**
|
||||||
|
- **OK** green · **INFO** blue/cyan · **WARN** yellow (never red)
|
||||||
|
- **ERROR** red · **BLOCKER** magenta · **PROG** cyan bar
|
||||||
- Progress: auto estimate per phase, or `PROGRESS_TOTAL=N` / `PROGRESS_OFF=1`
|
- Progress: auto estimate per phase, or `PROGRESS_TOTAL=N` / `PROGRESS_OFF=1`
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
|
||||||
|
|
@ -359,30 +359,36 @@ koopa_ssh_python() {
|
||||||
with_timeout "$t" ssh "${SSH_BASE_OPTS[@]}" "${KOOPA_SSH}" python3 -
|
with_timeout "$t" ssh "${SSH_BASE_OPTS[@]}" "${KOOPA_SSH}" python3 -
|
||||||
}
|
}
|
||||||
|
|
||||||
# ANSI colours — boxed badges (fg+bg) + body (label bold, detail dim).
|
# ANSI colours — left badge (clear severity) + body label colour + dim detail.
|
||||||
# Off: NO_COLOR=1 or CLICOLOR=0.
|
# Off: NO_COLOR=1 or CLICOLOR=0.
|
||||||
|
# OK green badge · green label
|
||||||
|
# INFO blue badge · cyan label
|
||||||
|
# WARN yellow badge · yellow label (never red)
|
||||||
|
# ERROR red badge · red label
|
||||||
|
# BLOCKER magenta badge· magenta label
|
||||||
|
# PROG cyan bar line
|
||||||
if [ "${NO_COLOR:-0}" = "1" ] || [ "${CLICOLOR:-1}" = "0" ]; then
|
if [ "${NO_COLOR:-0}" = "1" ] || [ "${CLICOLOR:-1}" = "0" ]; then
|
||||||
G= R= Y= C= M= D= W= B= N=
|
G= R= Y= C= M= D= W= B= N=
|
||||||
BG_OK= BG_INFO= BG_WARN= BG_ERR= BG_BLK= BG_SEC=
|
BG_OK= BG_INFO= BG_WARN= BG_ERR= BG_BLK= BG_SEC= BG_PROG=
|
||||||
BOX=0
|
BOX=0
|
||||||
else
|
else
|
||||||
G=$'\e[1;32m' # green text (totals)
|
G=$'\e[1;32m' # green
|
||||||
R=$'\e[1;31m' # red text
|
R=$'\e[1;31m' # red
|
||||||
Y=$'\e[1;33m' # yellow text
|
Y=$'\e[1;33m' # yellow
|
||||||
C=$'\e[1;36m' # cyan text
|
C=$'\e[1;36m' # cyan
|
||||||
M=$'\e[1;35m' # magenta text
|
M=$'\e[1;35m' # magenta
|
||||||
D=$'\e[2m' # dim tid / detail
|
D=$'\e[2m' # dim tid / detail
|
||||||
W=$'\e[1;37m' # bold white label
|
W=$'\e[1;37m' # bold white
|
||||||
B=$'\e[1m' # bold section
|
B=$'\e[1m' # bold
|
||||||
N=$'\e[0m' # reset
|
N=$'\e[0m' # reset
|
||||||
# Badge fill: bright text on solid background
|
# High-contrast left badges (bright white / black on strong bg)
|
||||||
# WARN = yellow only (never red). ERROR/BLOCKER use red/magenta.
|
BG_OK=$'\e[1;97;42m' # white on green
|
||||||
BG_OK=$'\e[1;30;42m' # black on green
|
BG_INFO=$'\e[1;97;44m' # white on blue
|
||||||
BG_INFO=$'\e[1;30;46m' # black on cyan
|
BG_WARN=$'\e[1;30;103m' # black on bright yellow — not red
|
||||||
BG_WARN=$'\e[1;30;103m' # black on bright yellow (clearly not red)
|
BG_ERR=$'\e[1;97;41m' # white on red — errors only
|
||||||
BG_ERR=$'\e[1;37;41m' # white on red — errors only
|
BG_BLK=$'\e[1;97;45m' # white on magenta — blockers
|
||||||
BG_BLK=$'\e[1;37;45m' # white on magenta — blockers
|
BG_SEC=$'\e[1;97;44m' # white on blue (section)
|
||||||
BG_SEC=$'\e[1;37;44m' # white on blue (section)
|
BG_PROG=$'\e[1;30;106m' # black on bright cyan (progress)
|
||||||
BOX=1
|
BOX=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -511,17 +517,17 @@ _progress_bar_line() {
|
||||||
i=0
|
i=0
|
||||||
while [ "$i" -lt "$empty" ]; do bar="${bar}░"; i=$((i + 1)); done
|
while [ "$i" -lt "$empty" ]; do bar="${bar}░"; i=$((i + 1)); done
|
||||||
if [ "${BOX:-0}" = "1" ]; then
|
if [ "${BOX:-0}" = "1" ]; then
|
||||||
printf '%s%s┌ PROG ┐%s %s%s%s %s%3d%%%s %s%d/%d%s\n' \
|
printf '%s┌ PROG ┐%s %s%s%s %s%3d%%%s %s%d/%d%s\n' \
|
||||||
"$D" "$C" "$N" "$C" "$bar" "$N" "$W" "$pct" "$N" "$D" "$done" "$total" "$N"
|
"$BG_PROG" "$N" "$C" "$bar" "$N" "$W" "$pct" "$N" "$D" "$done" "$total" "$N"
|
||||||
else
|
else
|
||||||
printf -- '[ PROG ] [%s] %3d%% %d/%d\n' "$bar" "$pct" "$done" "$total"
|
printf -- '%s[ PROG ]%s [%s] %3d%% %d/%d\n' "$C" "$N" "$bar" "$pct" "$done" "$total"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${BOX:-0}" = "1" ]; then
|
if [ "${BOX:-0}" = "1" ]; then
|
||||||
printf '%s%s┌ PROG ┐%s %sdone=%d%s (total unknown — set PROGRESS_TOTAL=)\n' \
|
printf '%s┌ PROG ┐%s %sdone=%d%s (total unknown — set PROGRESS_TOTAL=)\n' \
|
||||||
"$D" "$C" "$N" "$D" "$done" "$N"
|
"$BG_PROG" "$N" "$D" "$done" "$N"
|
||||||
else
|
else
|
||||||
printf -- '[ PROG ] done=%d (total unknown)\n' "$done"
|
printf -- '%s[ PROG ]%s done=%d (total unknown)\n' "$C" "$N" "$done"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -594,14 +600,14 @@ ok() {
|
||||||
# ok "what is good" ["concrete evidence: HTTP 200 · 12ms · …"]
|
# ok "what is good" ["concrete evidence: HTTP 200 · 12ms · …"]
|
||||||
local label="$1" detail="${2:-}"
|
local label="$1" detail="${2:-}"
|
||||||
_take_tid
|
_take_tid
|
||||||
_msg_line "$BG_OK" "OK" "$W" "$label" "$detail"
|
_msg_line "$BG_OK" "OK" "$G" "$label" "$detail"
|
||||||
PASS_N=$((PASS_N + 1))
|
PASS_N=$((PASS_N + 1))
|
||||||
}
|
}
|
||||||
# component-scoped error: err bank "what failed" "why / HTTP / path"
|
# component-scoped error: err bank "what failed" "why / HTTP / path"
|
||||||
err() {
|
err() {
|
||||||
local comp="$1" msg="$2" detail="${3:-}"
|
local comp="$1" msg="$2" detail="${3:-}"
|
||||||
_take_tid
|
_take_tid
|
||||||
_msg_line "$BG_ERR" "ERROR" "$W" "${comp}: ${msg}" "$detail"
|
_msg_line "$BG_ERR" "ERROR" "$R" "${comp}: ${msg}" "$detail"
|
||||||
FAIL_N=$((FAIL_N + 1))
|
FAIL_N=$((FAIL_N + 1))
|
||||||
ERRORS+=("${LAST_TID:+$LAST_TID }[$comp] $msg${detail:+ · $detail}")
|
ERRORS+=("${LAST_TID:+$LAST_TID }[$comp] $msg${detail:+ · $detail}")
|
||||||
}
|
}
|
||||||
|
|
@ -609,13 +615,14 @@ err() {
|
||||||
fail() {
|
fail() {
|
||||||
local label="$1" detail="${2:-}"
|
local label="$1" detail="${2:-}"
|
||||||
_take_tid
|
_take_tid
|
||||||
_msg_line "$BG_ERR" "ERROR" "$W" "$label" "$detail"
|
_msg_line "$BG_ERR" "ERROR" "$R" "$label" "$detail"
|
||||||
FAIL_N=$((FAIL_N + 1))
|
FAIL_N=$((FAIL_N + 1))
|
||||||
ERRORS+=("${LAST_TID:+$LAST_TID }$label${detail:+ · $detail}")
|
ERRORS+=("${LAST_TID:+$LAST_TID }$label${detail:+ · $detail}")
|
||||||
}
|
}
|
||||||
warn() {
|
warn() {
|
||||||
# warn "what is soft-bad" ["why still ok to continue"]
|
# warn "what is soft-bad" ["why still ok to continue"]
|
||||||
# warn component "what" "why"
|
# warn component "what" "why"
|
||||||
|
# Yellow only — never red (red = ERROR / BLOCKER path)
|
||||||
local a1="${1:-}" a2="${2:-}" a3="${3:-}"
|
local a1="${1:-}" a2="${2:-}" a3="${3:-}"
|
||||||
local head detail
|
local head detail
|
||||||
_take_tid
|
_take_tid
|
||||||
|
|
@ -629,7 +636,6 @@ warn() {
|
||||||
head="$a1"
|
head="$a1"
|
||||||
detail=""
|
detail=""
|
||||||
fi
|
fi
|
||||||
# Label in yellow text; badge yellow — never red (red = ERROR only)
|
|
||||||
_msg_line "$BG_WARN" "WARN" "$Y" "$head" "$detail"
|
_msg_line "$BG_WARN" "WARN" "$Y" "$head" "$detail"
|
||||||
WARN_N=$((WARN_N + 1))
|
WARN_N=$((WARN_N + 1))
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +643,14 @@ info() {
|
||||||
# info "topic" ["concrete fact / value / next step"]
|
# info "topic" ["concrete fact / value / next step"]
|
||||||
local label="$1" detail="${2:-}"
|
local label="$1" detail="${2:-}"
|
||||||
_take_tid
|
_take_tid
|
||||||
_msg_line "$BG_INFO" "INFO" "$W" "$label" "$detail"
|
_msg_line "$BG_INFO" "INFO" "$C" "$label" "$detail"
|
||||||
INFO_N=$((INFO_N + 1))
|
INFO_N=$((INFO_N + 1))
|
||||||
}
|
}
|
||||||
blocker() {
|
blocker() {
|
||||||
# Hard stop on pay/withdraw path: blocker "step" "why it cannot continue"
|
# Hard stop on pay/withdraw path: blocker "step" "why it cannot continue"
|
||||||
local step="$1" msg="$2"
|
local step="$1" msg="$2"
|
||||||
_take_tid
|
_take_tid
|
||||||
_msg_line "$BG_BLK" "BLOCKER" "$W" "${step}" "$msg"
|
_msg_line "$BG_BLK" "BLOCKER" "$M" "${step}" "$msg"
|
||||||
BLOCKERS+=("${LAST_TID:+$LAST_TID }[$step] $msg")
|
BLOCKERS+=("${LAST_TID:+$LAST_TID }[$step] $msg")
|
||||||
FAIL_N=$((FAIL_N + 1))
|
FAIL_N=$((FAIL_N + 1))
|
||||||
ERRORS+=("BLOCKER ${LAST_TID:+$LAST_TID }[$step] $msg")
|
ERRORS+=("BLOCKER ${LAST_TID:+$LAST_TID }[$step] $msg")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue