Files
proxmox/scripts/list-besu-vmids-from-proxmox.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

64 lines
3.0 KiB
Bash

#!/usr/bin/env bash
# SSH to each Proxmox host and list all VMIDs 1000-2999 (Besu range) with description and IP.
# Usage: bash scripts/list-besu-vmids-from-proxmox.sh [--csv]
# --csv: output CSV (VMID,Host,Description,IP,Type)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
HOSTS=(
"${PROXMOX_ML110:-192.168.11.10}"
"${PROXMOX_R630_01:-192.168.11.11}"
"${PROXMOX_R630_02:-192.168.11.12}"
)
SSH_OPTS="-o ConnectTimeout=8 -o StrictHostKeyChecking=no"
VMID_MIN=1000
VMID_MAX=2999
CSV=false
[[ "${1:-}" = "--csv" ]] && CSV=true
if $CSV; then
echo "VMID,Host,Description,IP,Type"
fi
for host in "${HOSTS[@]}"; do
# LXC containers in range
vmids_pct=$(ssh $SSH_OPTS root@"$host" "pct list 2>/dev/null | tail -n +2 | awk '\$1 >= $VMID_MIN && \$1 <= $VMID_MAX {print \$1}'" 2>/dev/null || true)
for vmid in $vmids_pct; do
[[ -z "$vmid" ]] && continue
desc=$(ssh $SSH_OPTS root@"$host" "pct config $vmid 2>/dev/null | grep '^hostname:' | sed 's/^hostname:[[:space:]]*//'" 2>/dev/null | head -1 || echo "")
[[ -z "$desc" ]] && desc=$(ssh $SSH_OPTS root@"$host" "pct config $vmid 2>/dev/null | grep '^name:' | sed 's/^name:[[:space:]]*//'" 2>/dev/null | head -1 || echo "CT-$vmid")
ip=$(ssh $SSH_OPTS root@"$host" "pct config $vmid 2>/dev/null | grep -oE 'ip=[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 | cut -d= -f2" 2>/dev/null || echo "")
status=$(ssh $SSH_OPTS root@"$host" "pct list 2>/dev/null | awk '\$1==$vmid {print \$3}'" 2>/dev/null || echo "")
if $CSV; then
echo "$vmid,$host,\"$desc\",$ip,LXC"
else
printf "%-6s %-20s %-40s %-16s %s\n" "$vmid" "$host" "$desc" "${ip:-N/A}" "${status:-}"
fi
done
# QEMU VMs in range
vmids_qm=$(ssh $SSH_OPTS root@"$host" "qm list 2>/dev/null | tail -n +2 | awk '\$1 >= $VMID_MIN && \$1 <= $VMID_MAX {print \$1}'" 2>/dev/null || true)
for vmid in $vmids_qm; do
[[ -z "$vmid" ]] && continue
desc=$(ssh $SSH_OPTS root@"$host" "qm config $vmid 2>/dev/null | grep '^name:' | sed 's/^name:[[:space:]]*//'" 2>/dev/null | head -1 || echo "VM-$vmid")
# QEMU IP often from guest agent or net0; try qm guest cmd if available
ip=$(ssh $SSH_OPTS root@"$host" "qm config $vmid 2>/dev/null | grep -oE 'ip=[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 | cut -d= -f2" 2>/dev/null || echo "")
[[ -z "$ip" ]] && ip=$(ssh $SSH_OPTS root@"$host" "qm guest cmd $vmid network-get-interfaces 2>/dev/null | grep -oE '\"ip-address\":\"[0-9.]+\"' | head -1 | cut -d'\"' -f4" 2>/dev/null || echo "")
status=$(ssh $SSH_OPTS root@"$host" "qm list 2>/dev/null | awk '\$1==$vmid {print \$3}'" 2>/dev/null || echo "")
if $CSV; then
echo "$vmid,$host,\"$desc\",$ip,QEMU"
else
printf "%-6s %-20s %-40s %-16s %s\n" "$vmid" "$host" "$desc" "${ip:-N/A}" "${status:-}"
fi
done
done
if ! $CSV; then
echo ""
echo "Besu range: VMID 1000-2999 (validators, sentries, RPCs). Hosts: ml110 .10, r630-01 .11, r630-02 .12."
fi