Files
proxmox/scripts/archive/consolidated/verify/check-container-memory-limits.sh.bak
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

92 lines
3.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Check memory limits for all containers on r630-02
# Usage: ./scripts/check-container-memory-limits.sh
set -euo pipefail
PROXMOX_HOST="192.168.11.12"
# Colors
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${CYAN}${NC} $1"; }
log_success() { echo -e "${GREEN}${NC} $1"; }
log_warn() { echo -e "${YELLOW}${NC} $1"; }
log_error() { echo -e "${RED}${NC} $1"; }
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}Container Memory Limits Review - r630-02${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Get all containers
CONTAINER_VMIDS=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct list 2>/dev/null | tail -n +2 | awk '{print \$1}'" || echo "")
if [ -z "$CONTAINER_VMIDS" ]; then
log_warn "No containers found"
exit 0
fi
echo "VMID | Name | Memory Limit | Swap | Current Usage | Status"
echo "-----|------|--------------|------|---------------|--------"
for vmid in $CONTAINER_VMIDS; do
# Get container info
CONTAINER_INFO=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct list 2>/dev/null | grep \"^$vmid\" || echo \"\"" 2>/dev/null)
if [ -z "$CONTAINER_INFO" ]; then
continue
fi
name=$(echo "$CONTAINER_INFO" | awk '{print $3}')
status=$(echo "$CONTAINER_INFO" | awk '{print $2}')
# Get memory configuration
MEMORY=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct config $vmid 2>/dev/null | grep '^memory:' | awk '{print \$2}'" 2>/dev/null || echo "N/A")
SWAP=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct config $vmid 2>/dev/null | grep '^swap:' | awk '{print \$2}'" 2>/dev/null || echo "N/A")
# Get current memory usage if running
if [ "$status" = "running" ]; then
CURRENT_USAGE=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $vmid -- free -m 2>/dev/null | grep Mem | awk '{print \$3}'" 2>/dev/null || echo "N/A")
else
CURRENT_USAGE="N/A (stopped)"
fi
# Format memory values (memory is in bytes, convert to MB)
if [ "$MEMORY" != "N/A" ] && [ -n "$MEMORY" ] && [ "$MEMORY" != "0" ]; then
MEMORY_MB=$((MEMORY / 1024 / 1024))
MEMORY_DISPLAY="${MEMORY_MB}MB"
else
MEMORY_DISPLAY="Not set"
fi
if [ "$SWAP" != "N/A" ] && [ -n "$SWAP" ] && [ "$SWAP" != "0" ]; then
SWAP_MB=$((SWAP / 1024 / 1024))
SWAP_DISPLAY="${SWAP_MB}MB"
else
SWAP_DISPLAY="Not set"
fi
if [ "$CURRENT_USAGE" != "N/A" ] && [ "$CURRENT_USAGE" != "N/A (stopped)" ]; then
CURRENT_DISPLAY="${CURRENT_USAGE}MB"
else
CURRENT_DISPLAY="$CURRENT_USAGE"
fi
echo "$vmid | $name | $MEMORY_DISPLAY | $SWAP_DISPLAY | $CURRENT_DISPLAY | $status"
done
echo ""