Files
proxmox/scripts/identify-dhcp-containers.sh
defiQUG cb47cce074 Complete markdown files cleanup and organization
- Organized 252 files across project
- Root directory: 187 → 2 files (98.9% reduction)
- Moved configuration guides to docs/04-configuration/
- Moved troubleshooting guides to docs/09-troubleshooting/
- Moved quick start guides to docs/01-getting-started/
- Moved reports to reports/ directory
- Archived temporary files
- Generated comprehensive reports and documentation
- Created maintenance scripts and guides

All files organized according to established standards.
2026-01-06 01:46:25 -08:00

57 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Identify all containers using DHCP
# Shows current DHCP-assigned IPs
set -euo pipefail
INVENTORY_CSV=$(ls -t /home/intlc/projects/proxmox/container_inventory_*.csv 2>/dev/null | head -1)
if [ -z "$INVENTORY_CSV" ] || [ ! -f "$INVENTORY_CSV" ]; then
echo "Error: No inventory CSV file found. Please run scan-all-containers.py first."
exit 1
fi
OUTPUT_FILE="/home/intlc/projects/proxmox/DHCP_CONTAINERS_$(date +%Y%m%d_%H%M%S).md"
echo "=== Identifying DHCP Containers ==="
echo ""
cat > "$OUTPUT_FILE" << EOF
# DHCP Containers - Complete List
**Generated**: $(date)
**Source**: $INVENTORY_CSV
---
## DHCP Containers
| VMID | Name | Host | Status | Current DHCP IP | Hostname |
|------|------|------|--------|----------------|----------|
EOF
dhcp_count=0
# Read CSV and filter DHCP containers
tail -n +2 "$INVENTORY_CSV" | while IFS=',' read -r vmid name host status ip_config current_ip hostname; do
# Remove quotes from name
name=$(echo "$name" | tr -d '"')
if [ "$ip_config" = "dhcp" ] || [ "$ip_config" = "auto" ]; then
dhcp_count=$((dhcp_count + 1))
echo "| $vmid | $name | $host | $status | $current_ip | $hostname |" >> "$OUTPUT_FILE"
echo " VMID $vmid ($name) on $host - Current IP: $current_ip"
fi
done
# Count total
dhcp_count=$(tail -n +2 "$INVENTORY_CSV" | grep -c ",dhcp," || echo "0")
if [ "$dhcp_count" -eq 0 ]; then
dhcp_count=$(tail -n +2 "$INVENTORY_CSV" | grep -c ",auto," || echo "0")
fi
echo ""
echo "=== Summary ==="
echo "Total DHCP containers: $dhcp_count"
echo "Output file: $OUTPUT_FILE"