Files
PFVCluster/proxmox/perf/scripts/probe-vm-dns.sh
T
mrcharles ec6e228b05 chore: adopt TSYSGroupAIOS framework (git hooks, rules engine, SoR policy)
Brings in the enforcement layer from ~/daytoday/meta:
- Makefile, scripts/ (check-rules.sh, setup-hooks.sh, pre-commit/pre-push,
  docker-run.sh, garden.sh, lib/common.sh)
- WORKING.md, questions-v1.md, .env.example
- Git hooks installed (pre-commit: fast audit, pre-push: full audit)

Fixes to pass rule audit:
- Pin Pi-hole/autoheal Docker images (no :latest tags)
- Fix shellcheck SC2001 in probe-vm-dns.sh
- Prune vendor/ and archive/ from shellcheck + Discourse pointer checks
- Add Quick Start, Enforcement Model, Task Tracking, Working Style
  sections to AGENTS.md from template

💘 Generated with Crush

Assisted-by: Crush:glm-5.2
2026-08-07 12:29:36 -05:00

45 lines
1.5 KiB
Bash

#!/bin/bash
# Read-only DNS consistency checker for Proxmox VMs.
# Checks that every running VM's name resolves to the IP it's actually using,
# and that reverse DNS (PTR) matches the VM name. Mismatches are reported as bugs.
set -u
echo "===== VM DNS CONSISTENCY CHECK: $(hostname -s) $(date -u +%FT%TZ) ====="
echo
echo "##### Running VMs with IPs (via guest-agent or ARP) #####"
for vmid in $(qm list 2>/dev/null | awk 'NR>1 && $4=="running" {print $1}'); do
name=$(qm config "$vmid" 2>/dev/null | awk '/^name:/{print $2}')
# Get the VM's net0 config to determine the bridge
net0=$(qm config "$vmid" 2>/dev/null | awk '/^net0:/{print $0}')
echo ""
echo "--- VMID $vmid: $name ---"
echo " net0: ${net0//net0: /}"
# Try to get IP via guest-agent
if qm config "$vmid" 2>/dev/null | grep -q 'agent:.*enabled=1\|^agent: 1'; then
guest_ips=$(qm guest cmd "$vmid" network-get-interfaces 2>/dev/null)
if [ -n "$guest_ips" ]; then
echo " guest-agent IPs:"
echo "$guest_ips" | python3 -c "
import sys, json
try:
data = json.load(sys.stdin)
for iface in data:
name = iface.get('name','?')
for addr in iface.get('ip-addresses',[]):
ip = addr.get('ip-address','')
typ = addr.get('ip-address-type','')
if typ == 'ipv4' and not ip.startswith('127.'):
print(f' {name}: {ip}')
except: pass
" 2>/dev/null
else
echo " guest-agent: no response"
fi
else
echo " guest-agent: not enabled"
fi
done
echo
echo "===== END $(hostname -s) ====="