Files
proxmox/scripts/query-missing-vmids.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

95 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Query missing VMID details from Proxmox VE
# Usage: ./scripts/query-missing-vmids.sh
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
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# VMIDs to query
VMIDS=(10202 10210 8641)
HOSTS=(
"r630-01:${PROXMOX_HOST_R630_01:-192.168.11.11}"
"r630-02:${PROXMOX_HOST_R630_02:-192.168.11.12}"
)
log_info "Querying missing VMID details..."
echo ""
for vmid in "${VMIDS[@]}"; do
log_info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
log_info "VMID: $vmid"
log_info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
found=false
for host_entry in "${HOSTS[@]}"; do
IFS=':' read -r hostname host_ip <<< "$host_entry"
# Check if container exists on this host
if ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host_ip" "pct list 2>/dev/null | grep -q '^$vmid '" 2>/dev/null; then
found=true
log_info "Found on host: $hostname ($host_ip)"
# Get container details
container_info=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host_ip" "
name=\$(pct config $vmid 2>/dev/null | grep '^name:' | cut -d: -f2 | tr -d ' ' || echo 'N/A')
hostname_vm=\$(pct config $vmid 2>/dev/null | grep '^hostname:' | cut -d: -f2 | tr -d ' ' || echo 'N/A')
status=\$(pct status $vmid 2>/dev/null | grep 'status:' | awk '{print \$2}' || echo 'unknown')
net_config=\$(pct config $vmid 2>/dev/null | grep '^net0:' || echo '')
# Get IP address
ip_address='N/A'
if echo \"\$net_config\" | grep -q 'ip='; then
ip_config=\$(echo \"\$net_config\" | grep -oE 'ip=[^,]+' | cut -d= -f2)
if [ \"\$ip_config\" = 'dhcp' ] || [ \"\$ip_config\" = 'auto' ]; then
if [ \"\$status\" = 'running' ]; then
ip_address=\$(pct exec $vmid -- hostname -I 2>/dev/null | awk '{print \$1}' || echo 'N/A')
else
ip_address='DHCP (container stopped)'
fi
else
ip_address=\$(echo \"\$ip_config\" | cut -d'/' -f1)
fi
fi
echo \"\$name|\$hostname_vm|\$status|\$ip_address\"
" 2>/dev/null || echo "||||")
IFS='|' read -r name hostname_vm status ip_address <<< "$container_info"
echo ""
echo " Name: $name"
echo " Hostname: $hostname_vm"
echo " Status: $status"
echo " IP Address: $ip_address"
echo " Host: $hostname"
echo ""
# Output in format for MASTER_VMID_INVENTORY.md
echo " 📋 Update MASTER_VMID_INVENTORY.md with:"
echo " | $vmid | $hostname_vm | $ip_address | $hostname | $status | [Purpose] |"
echo ""
break
fi
done
if [ "$found" = false ]; then
log_warn "VMID $vmid not found on any host"
echo ""
fi
done
log_info "Query complete!"