igneum/packaging/linux/bin/rig-status
igneum-labs cf716a6910 Rig installer for Ubuntu 24.04: install-rig.sh, the six units (node, miner@card, prover, telemetry, update timer), rig-status, the signed-manifest and package checks, the self-test; console accepts linux labels
packaging/linux: preflight (Ubuntu 24.04, NVIDIA driver 580 floor with libcuda and libnvrtc.so.12, AMD ROCm OpenCL ICD, Intel compute runtime, nvidia-smi and the OpenCL list printed, RAM, free disk, ports, ufw), the wallet and rig name asked once, the igneum system user, the Ed25519 check of dl/public/igneum-app-latest.json with the OTA public key (OpenSSL 3 pkeyutl -rawin, python3 cryptography fallback, never skipped), consensus.override written from the verified manifest and refreshed hourly (the HiveOS override rule without a package republish), the HiveOS package downloaded with size and sha256 checked (the signed linux entry when the manifest has one, else the .sha256 sidecar behind --allow-sidecar-sha256, said in capitals), releases under /opt/igneum with a current symlink and a 90-s rollback, one miner unit per card with CUDA_DEVICE_ORDER=PCI_BUS_ID and the OpenCL ordinal mapping, the integrated GPU and the BMC VGA excluded by the inventory, the prover unit as the proving-v1 loop in bash (12 GB gate, 20 GB mine-and-prove line with the card's miner paused per shard through a sudoers rule, idles in state setup while no Linux prover binary is published), telemetry in the app's line shapes with the relay upload under nodelog-linux/miner-<vendor>/linux labels, the identities rule with its 8 GiB threshold.

Tested on the Mac: shellcheck -x -S style clean, bash -n, check-units.sh (6 units, the systemd-analyze stand-in; no systemd or Docker here), the inventory on a fake sysfs tree, the rules, the live manifest verified by both verifiers and tampered copies refused, the installer dry run with the 0.3.9 package downloaded and verified. Untested until a rig exists: listed in README.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-05 20:37:51 +00:00

34 lines
3.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# rig-status: per card the hash rate (the miner's last STATUS line, now= MH/s), watts and temperature (the last
# telemetry line), MH/W, accepted and rejected blocks and the unit state; the node's height, peers and sync state
# (igneum-miner watch); the prover's state (/run/igneum/prover.state); the last update line; versions. Read-only.
set -uo pipefail
# shellcheck source-path=SCRIPTDIR
# shellcheck source=igneum-rig-lib.sh
. /opt/igneum/bin/igneum-rig-lib.sh
load_conf
unit_state() { systemctl is-active "$1" 2>/dev/null || echo unknown; }
printf 'Igneum rig %s (%s, %s, machine %s); package %s; prover default %s\n' "$RIG_NAME" "$NETWORK" "$(hostname)" "$ID8" "$(installed_version)" "$(prover_decision | cut -d' ' -f1)"
printf '%-8s %-30s %-9s %9s %7s %7s %8s %9s %9s %s\n' CARD NAME UNIT 'MH/s' W 'GPU C' 'MH/W' ACCEPTED REJECTED 'STATUS AGE'
total_mhs=0; total_w=0
while read -r line; do
[[ -z "$line" ]] && continue
c="$(card_field "$line" 1)"; name="$(card_field "$line" 7)"
st="$(journalctl -u "igneum-miner@$c" -o cat -n 400 --no-pager 2>/dev/null | grep ' STATUS ' | tail -1)"
mhs="$(printf '%s' "$st" | sed -n 's/.* now=\([0-9.]*\) MH\/s.*/\1/p')"; [[ -n "$mhs" ]] || mhs="$(printf '%s' "$st" | sed -n 's/.* hash=\([0-9.]*\) MH\/s.*/\1/p')"
acc="$(printf '%s' "$st" | sed -n 's/.* accepted=\([0-9]*\).*/\1/p')"; rej="$(printf '%s' "$st" | sed -n 's/.* rejected=\([0-9]*\).*/\1/p')"
age="-"; t="$(printf '%s' "$st" | awk '{print int($1)}')"; [[ -n "$t" && "$t" -gt 0 ]] && age="$(( $(date +%s) - t ))s"
tel="$(cat "$IGNEUM_RUN/telemetry/$c" 2>/dev/null)"
w="$(printf '%s' "$tel" | sed -n 's/.* watts \([0-9.]*\).*/\1/p')"; tc="$(printf '%s' "$tel" | sed -n 's/.* temp_c \([0-9.]*\).*/\1/p')"
mhw="-"; [[ -n "$w" && -n "$mhs" ]] && mhw="$(awk -v m="$mhs" -v p="$w" 'BEGIN{ if (p > 0) printf "%.3f", m/p; else print "-" }')"
printf '%-8s %-30.30s %-9s %9s %7s %7s %8s %9s %9s %s\n' "$c" "$name" "$(unit_state "igneum-miner@$c")" "${mhs:--}" "${w:--}" "${tc:--}" "$mhw" "${acc:--}" "${rej:--}" "$age"
total_mhs="$(awk -v a="$total_mhs" -v b="${mhs:-0}" 'BEGIN{printf "%.2f", a+b}')"; total_w="$(awk -v a="$total_w" -v b="${w:-0}" 'BEGIN{printf "%.1f", a+b}')"
done < <(inventory)
printf '%-8s %-30s %-9s %9s %7s %7s %8s\n' total '' '' "$total_mhs" "$total_w" '' "$(awk -v m="$total_mhs" -v p="$total_w" 'BEGIN{ if (p > 0) printf "%.3f", m/p; else print "-" }')"
nl="$(node_watch_line)"
if [[ -n "$nl" ]]; then
printf 'node %s: blocks %s, headers %s, daa %s, peers %s, %s\n' "$(unit_state igneum-node)" "$(node_field "$nl" blocks)" "$(node_field "$nl" headers)" "$(node_field "$nl" daa)" "$(node_field "$nl" peers)" "$( [[ "$(node_field "$nl" synced)" == true ]] && echo synced || echo 'not synced' )"
else printf 'node %s: no answer on %s\n' "$(unit_state igneum-node)" "$NODE_URL"; fi
printf 'prover %s: %s\n' "$(unit_state igneum-prover)" "$(cat "$IGNEUM_RUN/prover.state" 2>/dev/null || echo 'no state file yet')"
printf 'telemetry %s; relay upload %s\n' "$(unit_state igneum-telemetry)" "$(relay_configured && echo on || echo off)"
printf 'update timer %s; last: %s\n' "$(unit_state igneum-update.timer)" "$(journalctl -u igneum-update -o cat -n 1 --no-pager 2>/dev/null || echo none)"