Add surgical Besu validator operator helpers
This commit is contained in:
35
scripts/verify/report-besu-host-cpu-load.sh
Executable file
35
scripts/verify/report-besu-host-cpu-load.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Read-only: Proxmox host load vs logical CPUs + count of Besu-named LXCs per node.
|
||||
# Rule of thumb for "under 50% capacity": load average (1 min) / nproc < 0.5.
|
||||
#
|
||||
# Env: PROXMOX_BESU_LOAD_HOSTS — space-separated host IPs (default: ml110 + r630-01..04)
|
||||
#
|
||||
# Usage: bash scripts/verify/report-besu-host-cpu-load.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||||
|
||||
H="${PROXMOX_BESU_LOAD_HOSTS:-${PROXMOX_HOST_ML110:-192.168.11.10} ${PROXMOX_HOST_R630_01:-192.168.11.11} ${PROXMOX_HOST_R630_02:-192.168.11.12} ${PROXMOX_HOST_R630_03:-192.168.11.13} ${PROXMOX_HOST_R630_04:-192.168.11.14}}"
|
||||
SSH_OPTS=(-o ConnectTimeout=10 -o BatchMode=yes -o StrictHostKeyChecking=no)
|
||||
|
||||
echo "Besu-related host load (1m_load / nproc — target < 0.50)"
|
||||
echo "-------------------------------------------------------------------"
|
||||
|
||||
for ip in $H; do
|
||||
line=$(ssh "${SSH_OPTS[@]}" "root@${ip}" "printf '%s|%s|%s|%s\n' \"\$(hostname 2>/dev/null)\" \"\$(nproc 2>/dev/null)\" \"\$(cut -f1 -d' ' /proc/loadavg 2>/dev/null)\" \"\$(pct list 2>/dev/null | grep -ci besu || echo 0)\"" 2>/dev/null) || line=""
|
||||
if [[ -z "$line" ]]; then
|
||||
printf "%-16s UNREACHABLE\n" "$ip"
|
||||
continue
|
||||
fi
|
||||
IFS='|' read -r hn np l1 nb <<<"$line"
|
||||
np="${np:-1}"
|
||||
l1="${l1:-0}"
|
||||
ratio=$(awk -v L="$l1" -v N="$np" 'BEGIN { if (N+0>0) printf "%.2f", L/N; else print "?" }')
|
||||
flag="warn"
|
||||
awk -v r="$ratio" 'BEGIN{exit !(r+0<0.5)}' 2>/dev/null && flag="ok" || true
|
||||
printf "%-15s %-28s nproc=%-2s 1m=%-8s ratio=%-5s besu_cts=%-3s %s\n" "$ip" "$hn" "$np" "$l1" "$ratio" "$nb" "$flag"
|
||||
done
|
||||
Reference in New Issue
Block a user