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)
|
||||
- `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`
|
||||
|
||||
## Commands
|
||||
|
|
|
|||
|
|
@ -359,30 +359,36 @@ koopa_ssh_python() {
|
|||
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.
|
||||
# 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
|
||||
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
|
||||
else
|
||||
G=$'\e[1;32m' # green text (totals)
|
||||
R=$'\e[1;31m' # red text
|
||||
Y=$'\e[1;33m' # yellow text
|
||||
C=$'\e[1;36m' # cyan text
|
||||
M=$'\e[1;35m' # magenta text
|
||||
D=$'\e[2m' # dim tid / detail
|
||||
W=$'\e[1;37m' # bold white label
|
||||
B=$'\e[1m' # bold section
|
||||
N=$'\e[0m' # reset
|
||||
# Badge fill: bright text on solid background
|
||||
# WARN = yellow only (never red). ERROR/BLOCKER use red/magenta.
|
||||
BG_OK=$'\e[1;30;42m' # black on green
|
||||
BG_INFO=$'\e[1;30;46m' # black on cyan
|
||||
BG_WARN=$'\e[1;30;103m' # black on bright yellow (clearly not red)
|
||||
BG_ERR=$'\e[1;37;41m' # white on red — errors only
|
||||
BG_BLK=$'\e[1;37;45m' # white on magenta — blockers
|
||||
BG_SEC=$'\e[1;37;44m' # white on blue (section)
|
||||
G=$'\e[1;32m' # green
|
||||
R=$'\e[1;31m' # red
|
||||
Y=$'\e[1;33m' # yellow
|
||||
C=$'\e[1;36m' # cyan
|
||||
M=$'\e[1;35m' # magenta
|
||||
D=$'\e[2m' # dim tid / detail
|
||||
W=$'\e[1;37m' # bold white
|
||||
B=$'\e[1m' # bold
|
||||
N=$'\e[0m' # reset
|
||||
# High-contrast left badges (bright white / black on strong bg)
|
||||
BG_OK=$'\e[1;97;42m' # white on green
|
||||
BG_INFO=$'\e[1;97;44m' # white on blue
|
||||
BG_WARN=$'\e[1;30;103m' # black on bright yellow — not red
|
||||
BG_ERR=$'\e[1;97;41m' # white on red — errors only
|
||||
BG_BLK=$'\e[1;97;45m' # white on magenta — blockers
|
||||
BG_SEC=$'\e[1;97;44m' # white on blue (section)
|
||||
BG_PROG=$'\e[1;30;106m' # black on bright cyan (progress)
|
||||
BOX=1
|
||||
fi
|
||||
|
||||
|
|
@ -511,17 +517,17 @@ _progress_bar_line() {
|
|||
i=0
|
||||
while [ "$i" -lt "$empty" ]; do bar="${bar}░"; i=$((i + 1)); done
|
||||
if [ "${BOX:-0}" = "1" ]; then
|
||||
printf '%s%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"
|
||||
printf '%s┌ PROG ┐%s %s%s%s %s%3d%%%s %s%d/%d%s\n' \
|
||||
"$BG_PROG" "$N" "$C" "$bar" "$N" "$W" "$pct" "$N" "$D" "$done" "$total" "$N"
|
||||
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
|
||||
else
|
||||
if [ "${BOX:-0}" = "1" ]; then
|
||||
printf '%s%s┌ PROG ┐%s %sdone=%d%s (total unknown — set PROGRESS_TOTAL=)\n' \
|
||||
"$D" "$C" "$N" "$D" "$done" "$N"
|
||||
printf '%s┌ PROG ┐%s %sdone=%d%s (total unknown — set PROGRESS_TOTAL=)\n' \
|
||||
"$BG_PROG" "$N" "$D" "$done" "$N"
|
||||
else
|
||||
printf -- '[ PROG ] done=%d (total unknown)\n' "$done"
|
||||
printf -- '%s[ PROG ]%s done=%d (total unknown)\n' "$C" "$N" "$done"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
@ -594,14 +600,14 @@ ok() {
|
|||
# ok "what is good" ["concrete evidence: HTTP 200 · 12ms · …"]
|
||||
local label="$1" detail="${2:-}"
|
||||
_take_tid
|
||||
_msg_line "$BG_OK" "OK" "$W" "$label" "$detail"
|
||||
_msg_line "$BG_OK" "OK" "$G" "$label" "$detail"
|
||||
PASS_N=$((PASS_N + 1))
|
||||
}
|
||||
# component-scoped error: err bank "what failed" "why / HTTP / path"
|
||||
err() {
|
||||
local comp="$1" msg="$2" detail="${3:-}"
|
||||
_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))
|
||||
ERRORS+=("${LAST_TID:+$LAST_TID }[$comp] $msg${detail:+ · $detail}")
|
||||
}
|
||||
|
|
@ -609,13 +615,14 @@ err() {
|
|||
fail() {
|
||||
local label="$1" detail="${2:-}"
|
||||
_take_tid
|
||||
_msg_line "$BG_ERR" "ERROR" "$W" "$label" "$detail"
|
||||
_msg_line "$BG_ERR" "ERROR" "$R" "$label" "$detail"
|
||||
FAIL_N=$((FAIL_N + 1))
|
||||
ERRORS+=("${LAST_TID:+$LAST_TID }$label${detail:+ · $detail}")
|
||||
}
|
||||
warn() {
|
||||
# warn "what is soft-bad" ["why still ok to continue"]
|
||||
# warn component "what" "why"
|
||||
# Yellow only — never red (red = ERROR / BLOCKER path)
|
||||
local a1="${1:-}" a2="${2:-}" a3="${3:-}"
|
||||
local head detail
|
||||
_take_tid
|
||||
|
|
@ -629,7 +636,6 @@ warn() {
|
|||
head="$a1"
|
||||
detail=""
|
||||
fi
|
||||
# Label in yellow text; badge yellow — never red (red = ERROR only)
|
||||
_msg_line "$BG_WARN" "WARN" "$Y" "$head" "$detail"
|
||||
WARN_N=$((WARN_N + 1))
|
||||
}
|
||||
|
|
@ -637,14 +643,14 @@ info() {
|
|||
# info "topic" ["concrete fact / value / next step"]
|
||||
local label="$1" detail="${2:-}"
|
||||
_take_tid
|
||||
_msg_line "$BG_INFO" "INFO" "$W" "$label" "$detail"
|
||||
_msg_line "$BG_INFO" "INFO" "$C" "$label" "$detail"
|
||||
INFO_N=$((INFO_N + 1))
|
||||
}
|
||||
blocker() {
|
||||
# Hard stop on pay/withdraw path: blocker "step" "why it cannot continue"
|
||||
local step="$1" msg="$2"
|
||||
_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")
|
||||
FAIL_N=$((FAIL_N + 1))
|
||||
ERRORS+=("BLOCKER ${LAST_TID:+$LAST_TID }[$step] $msg")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue