0050_MobaXterm macros: 08.Debian-Virtualization_Assessment

8.1 Virtualization Detection (systemd-detect-virt & virt-what Engine Diagnostics)
8.2 System / Hypervisor Identity (Low-Level DMI/Hardware Profile)
8.3 KVM Host Capability (+ Kernel Modules Validation & /dev/kvm Access)
8.4 QEMU Guest Agent (+ Packages, Virtio Channel & Runtime Logs Loop)
8.5 Virtio Devices / Drivers (+ Memory Ballooning Evaluation)
8.6 VMware Tools / open-vm-tools (Services, Versions & Specific Drivers)
8.7 Hyper-V Integration Services (+ Active VMBus Sysfs Inventory)
8.8 Libvirt / QEMU Host (Service Topologies & virsh Domains Matrix)
8.9 Proxmox VE Information (Versions, Clusters, API Nodes, VMs, LXCs & Storage Status)
8.10 Proxmox Backup Server (Client-Side Architecture & Active Datastores)
8.11 LXC / systemd-nspawn Containers (Engine Profiles & Core Management Tools)
8.12 Docker / Podman / containerd (Socket States, Runtimes & Namespaces Auditing)8
.13 Cloud-init Integration (Deployment Status & Cloud Data Sources Mapping)
8.14 Virtual Network Bridges (Topology Switches, Links & Virtual Interface Footprints)
8.15 Guest / Container Workload Processes (Hypervisor Execution Engine Inspection)

Copy–>Past

echo "==================== 08. VIRTUALIZATION ASSESSMENT ===================="; printf "\n"; echo "8.1 VIRTUALIZATION DETECTION"; echo "--- systemd-detect-virt ---"; if command -v systemd-detect-virt >/dev/null 2>&1; then VIRT_TYPE=$(systemd-detect-virt 2>/dev/null); if [ -n "$VIRT_TYPE" ] && [ "$VIRT_TYPE" != "none" ]; then echo "Virtualization type: $VIRT_TYPE"; else echo "No virtualization detected; system may be physical"; fi; printf "\n"; echo "VM detection : $(systemd-detect-virt --vm 2>/dev/null || echo none)"; echo "Container detection : $(systemd-detect-virt --container 2>/dev/null || echo none)"; else echo "systemd-detect-virt not installed"; fi; printf "\n"; echo "--- Additional Detection ---"; if command -v virt-what >/dev/null 2>&1; then virt-what 2>/dev/null || echo "virt-what did not detect virtualization"; else echo "virt-what not installed"; fi; printf "\n"; echo "--- CPU Virtualization Features ---"; lscpu 2>/dev/null | grep -Ei 'Architecture|Vendor ID|Virtualization|Hypervisor vendor|Virtualization type' || echo "No virtualization information exposed by lscpu"; printf "\n%.0s" {1..3}; echo "8.2 SYSTEM / HYPERVISOR IDENTITY"; for ITEM in sys_vendor product_name product_version board_vendor board_name bios_vendor bios_version; do FILE="/sys/class/dmi/id/$ITEM"; if [ -r "$FILE" ]; then printf "%-18s: %s\n" "$ITEM" "$(cat "$FILE" 2>/dev/null)"; fi; done; printf "\n%.0s" {1..3}; echo "8.3 KVM HOST CAPABILITY"; echo "--- KVM Kernel Modules ---"; lsmod 2>/dev/null | grep -E '^kvm|kvm_(intel|amd)' || echo "KVM kernel modules are not loaded"; printf "\n"; echo "--- Hardware Virtualization Flags ---"; grep -Eom1 'vmx|svm' /proc/cpuinfo 2>/dev/null || echo "CPU virtualization flags not exposed"; printf "\n"; echo "--- /dev/kvm ---"; if [ -e /dev/kvm ]; then ls -l /dev/kvm; else echo "/dev/kvm not present"; fi; printf "\n"; echo "--- KVM Validation ---"; if command -v kvm-ok >/dev/null 2>&1; then kvm-ok 2>/dev/null; else echo "kvm-ok not installed"; fi; printf "\n%.0s" {1..3}; echo "8.4 QEMU GUEST AGENT"; echo "qemu-guest-agent: $(systemctl is-active qemu-guest-agent 2>/dev/null || echo inactive/not-installed)"; printf "\n"; echo "--- Guest Agent Package ---"; if command -v dpkg-query >/dev/null 2>&1; then dpkg-query -W -f='${Status} ${Version}\n' qemu-guest-agent 2>/dev/null || echo "qemu-guest-agent package not installed"; fi; printf "\n"; echo "--- Virtio Guest Agent Channel ---"; if [ -c /dev/virtio-ports/org.qemu.guest_agent.0 ]; then ls -l /dev/virtio-ports/org.qemu.guest_agent.0; else echo "QEMU Guest Agent virtio channel not detected"; fi; printf "\n"; echo "--- Recent Guest Agent Logs ---"; journalctl -u qemu-guest-agent -b -n 30 --no-pager 2>/dev/null || echo "QEMU Guest Agent journal unavailable"; printf "\n%.0s" {1..3}; echo "8.5 VIRTIO DEVICES / DRIVERS"; echo "--- Virtio PCI Devices ---"; lspci 2>/dev/null | grep -Ei 'virtio|red hat' || echo "No virtio PCI devices detected"; printf "\n"; echo "--- Virtio Kernel Modules ---"; lsmod 2>/dev/null | grep -E 'virtio|9pnet_virtio' || echo "No loaded virtio modules detected"; printf "\n"; echo "--- Balloon Driver ---"; lsmod 2>/dev/null | grep -E 'virtio_balloon|vmw_balloon|hv_balloon' || echo "No virtual memory balloon driver detected"; printf "\n%.0s" {1..3}; echo "8.6 VMWARE TOOLS"; echo "open-vm-tools: $(systemctl is-active open-vm-tools 2>/dev/null || echo inactive/not-installed)"; echo "vmtoolsd : $(systemctl is-active vmtoolsd 2>/dev/null || echo inactive/not-installed)"; printf "\n"; echo "--- VMware Tools Processes ---"; pgrep -a vmtoolsd 2>/dev/null || echo "vmtoolsd process not running"; printf "\n"; echo "--- VMware Tools Version ---"; if command -v vmware-toolbox-cmd >/dev/null 2>&1; then vmware-toolbox-cmd -v 2>/dev/null || echo "Unable to retrieve VMware Tools version"; else echo "vmware-toolbox-cmd not installed"; fi; printf "\n"; echo "--- VMware Kernel Drivers ---"; lsmod 2>/dev/null | grep -E 'vmw_|vmxnet|vsock' || echo "No VMware-specific modules detected"; printf "\n%.0s" {1..3}; echo "8.7 HYPER-V INTEGRATION SERVICES"; echo "hv-kvp-daemon : $(systemctl is-active hv-kvp-daemon 2>/dev/null || echo inactive/not-installed)"; echo "hv-vss-daemon : $(systemctl is-active hv-vss-daemon 2>/dev/null || echo inactive/not-installed)"; echo "hv-fcopy-daemon: $(systemctl is-active hv-fcopy-daemon 2>/dev/null || echo inactive/not-installed)"; printf "\n"; echo "--- Hyper-V Kernel Modules ---"; lsmod 2>/dev/null | grep -E '^hv_|hv_vmbus|hv_netvsc|hv_storvsc|hv_utils|hv_balloon' || echo "No Hyper-V kernel modules detected"; printf "\n"; echo "--- Hyper-V Devices ---"; find /sys/bus/vmbus/devices -maxdepth 1 -mindepth 1 -type l 2>/dev/null | head -30 || echo "No VMBus devices detected"; printf "\n%.0s" {1..3}; echo "8.8 LIBVIRT / QEMU HOST"; echo "libvirtd : $(systemctl is-active libvirtd 2>/dev/null || echo inactive/not-installed)"; echo "virtqemud : $(systemctl is-active virtqemud 2>/dev/null || echo inactive/not-installed)"; echo "virtlogd : $(systemctl is-active virtlogd 2>/dev/null || echo inactive/not-installed)"; echo "virtlockd : $(systemctl is-active virtlockd 2>/dev/null || echo inactive/not-installed)"; printf "\n"; if command -v virsh >/dev/null 2>&1; then echo "--- Libvirt Version ---"; virsh version 2>/dev/null || echo "Unable to query libvirt version"; printf "\n"; echo "--- Defined Virtual Machines ---"; timeout 5 virsh list --all 2>/dev/null || echo "Unable to query libvirt domains"; else echo "virsh not installed"; fi; printf "\n%.0s" {1..3}; echo "8.9 PROXMOX VE INFORMATION"; if command -v pveversion >/dev/null 2>&1; then echo "--- Proxmox VE Version ---"; pveversion -v 2>/dev/null | head -40; printf "\n"; echo "--- Cluster Status ---"; timeout 5 pvecm status 2>/dev/null | head -40 || echo "PVE cluster status unavailable or node is standalone"; printf "\n"; echo "--- Node Status ---"; timeout 5 pvesh get /nodes --output-format yaml 2>/dev/null | head -50 || echo "PVE node API status unavailable"; printf "\n"; echo "--- Virtual Machines ---"; qm list 2>/dev/null || echo "No QEMU virtual machines or qm unavailable"; printf "\n"; echo "--- LXC Containers ---"; pct list 2>/dev/null || echo "No LXC containers or pct unavailable"; printf "\n"; echo "--- PVE Storage ---"; pvesm status 2>/dev/null || echo "PVE storage status unavailable"; else echo "Proxmox VE tools not detected"; fi; printf "\n%.0s" {1..3}; echo "8.10 PROXMOX BACKUP SERVER"; if command -v proxmox-backup-manager >/dev/null 2>&1; then echo "--- PBS Version ---"; proxmox-backup-manager version 2>/dev/null || dpkg-query -W 'proxmox-backup*' 2>/dev/null; printf "\n"; echo "--- PBS Services ---"; echo "proxmox-backup : $(systemctl is-active proxmox-backup 2>/dev/null || echo inactive/not-installed)"; echo "proxmox-backup-proxy : $(systemctl is-active proxmox-backup-proxy 2>/dev/null || echo inactive/not-installed)"; printf "\n"; echo "--- Datastores ---"; proxmox-backup-manager datastore list 2>/dev/null || echo "PBS datastore information unavailable"; else echo "Proxmox Backup Server tools not detected"; fi; printf "\n%.0s" {1..3}; echo "8.11 LXC / SYSTEMD-NSPAWN CONTAINERS"; echo "lxc : $(systemctl is-active lxc 2>/dev/null || echo inactive/not-installed)"; echo "lxcfs : $(systemctl is-active lxcfs 2>/dev/null || echo inactive/not-installed)"; echo "machines : $(systemctl is-active systemd-machined 2>/dev/null || echo inactive/not-installed)"; printf "\n"; if command -v lxc-ls >/dev/null 2>&1; then echo "--- LXC Containers ---"; lxc-ls --fancy 2>/dev/null || echo "Unable to query LXC containers"; fi; printf "\n"; if command -v machinectl >/dev/null 2>&1; then echo "--- systemd Machines ---"; machinectl list --no-pager 2>/dev/null || echo "No systemd-nspawn machines detected"; fi; printf "\n%.0s" {1..3}; echo "8.12 DOCKER / PODMAN / CONTAINERD"; echo "docker: $(systemctl is-active docker 2>/dev/null || echo inactive/not-installed)"; echo "podman: $(systemctl is-active podman 2>/dev/null || echo inactive/not-installed)"; echo "containerd: $(systemctl is-active containerd 2>/dev/null || echo inactive/not-installed)"; echo "cri-o: $(systemctl is-active crio 2>/dev/null || echo inactive/not-installed)"; printf "\n"; if command -v docker >/dev/null 2>&1; then echo "--- Docker Containers ---"; timeout 5 docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" 2>/dev/null | head -40 || echo "Docker daemon unavailable or access denied"; fi; printf "\n"; if command -v podman >/dev/null 2>&1; then echo "--- Podman Containers ---"; timeout 5 podman ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" 2>/dev/null | head -40 || echo "Podman unavailable or access denied"; fi; printf "\n"; if command -v ctr >/dev/null 2>&1; then echo "--- containerd Namespaces ---"; timeout 5 ctr namespaces list 2>/dev/null || echo "containerd socket unavailable or access denied"; fi; printf "\n%.0s" {1..3}; echo "8.13 CLOUD-INIT"; echo "cloud-init: $(systemctl is-active cloud-init 2>/dev/null || echo inactive/not-installed)"; printf "\n"; if command -v cloud-init >/dev/null 2>&1; then echo "--- Cloud-init Status ---"; cloud-init status --long 2>/dev/null || echo "Unable to query cloud-init status"; printf "\n"; echo "--- Cloud-init Data Source ---"; grep -R 'DataSource' /run/cloud-init/ 2>/dev/null | head -20 || echo "Cloud-init data source not detected"; else echo "cloud-init not installed"; fi; printf "\n%.0s" {1..3}; echo "8.14 VIRTUAL NETWORK BRIDGES"; echo "--- Linux Bridges ---"; ip -br link show type bridge 2>/dev/null || echo "No Linux bridge interfaces detected"; printf "\n"; echo "--- Bridge Members ---"; bridge link 2>/dev/null || echo "Bridge membership information unavailable"; printf "\n"; echo "--- Common Virtual Interfaces ---"; ip -br link 2>/dev/null | grep -Ei 'vmbr|virbr|vnet|tap|fwbr|fwln|fwpr|docker|br-|cni|flannel|veth' || echo "No common virtual interfaces detected"; printf "\n%.0s" {1..3}; echo "8.15 GUEST / CONTAINER PROCESSES"; ps -eo pid,ppid,user,%cpu,%mem,stat,etime,cmd 2>/dev/null | grep -Ei 'qemu-system|kvm|qemu-kvm|lxc-start|lxc-monitor|vboxheadless|vmware-vmx|containerd-shim|dockerd|podman|conmon' | grep -v grep | head -60 || echo "No active guest or container runtime processes detected"
# ==================== 08. VIRTUALIZATION ASSESSMENT ====================
echo "==================== 08. VIRTUALIZATION ASSESSMENT ===================="
printf "\n"

# --- 8.1 VIRTUALIZATION DETECTION ---
echo "8.1 VIRTUALIZATION DETECTION"
echo "--- systemd-detect-virt ---"
if command -v systemd-detect-virt >/dev/null 2>&1; then
    VIRT_TYPE=$(systemd-detect-virt 2>/dev/null)
    if [ -n "$VIRT_TYPE" ] && [ "$VIRT_TYPE" != "none" ]; then
        echo "Virtualization type: $VIRT_TYPE"
    else
        echo "No virtualization detected; system may be physical"
    fi
    printf "\n"
    echo "VM detection        : $(systemd-detect-virt --vm 2>/dev/null || echo none)"
    echo "Container detection : $(systemd-detect-virt --container 2>/dev/null || echo none)"
else
    echo "systemd-detect-virt not installed"
fi
printf "\n"
echo "--- Additional Detection ---"
if command -v virt-what >/dev/null 2>&1; then
    virt-what 2>/dev/null || echo "virt-what did not detect virtualization"
else
    echo "virt-what not installed"
fi
printf "\n"
echo "--- CPU Virtualization Features ---"
lscpu 2>/dev/null | grep -Ei 'Architecture|Vendor ID|Virtualization|Hypervisor vendor|Virtualization type' || echo "No virtualization information exposed by lscpu"
printf "\n%.0s" {1..3}

# --- 8.2 SYSTEM / HYPERVISOR IDENTITY ---
echo "8.2 SYSTEM / HYPERVISOR IDENTITY"
for ITEM in sys_vendor product_name product_version board_vendor board_name bios_vendor bios_version; do
    FILE="/sys/class/dmi/id/$ITEM"
    if [ -r "$FILE" ]; then
        printf "%-18s: %s\n" "$ITEM" "$(cat "$FILE" 2>/dev/null)"
    fi
done
printf "\n%.0s" {1..3}

# --- 8.3 KVM HOST CAPABILITY ---
echo "8.3 KVM HOST CAPABILITY"
echo "--- KVM Kernel Modules ---"
lsmod 2>/dev/null | grep -E '^kvm|kvm_(intel|amd)' || echo "KVM kernel modules are not loaded"
printf "\n"
echo "--- Hardware Virtualization Flags ---"
grep -Eom1 'vmx|svm' /proc/cpuinfo 2>/dev/null || echo "CPU virtualization flags not exposed"
printf "\n"
echo "--- /dev/kvm ---"
if [ -e /dev/kvm ]; then
    ls -l /dev/kvm
else
    echo "/dev/kvm not present"
fi
printf "\n"
echo "--- KVM Validation ---"
if command -v kvm-ok >/dev/null 2>&1; then
    kvm-ok 2>/dev/null
else
    echo "kvm-ok not installed"
fi
printf "\n%.0s" {1..3}

# --- 8.4 QEMU GUEST AGENT ---
echo "8.4 QEMU GUEST AGENT"
echo "qemu-guest-agent: $(systemctl is-active qemu-guest-agent 2>/dev/null || echo inactive/not-installed)"
printf "\n"
echo "--- Guest Agent Package ---"
if command -v dpkg-query >/dev/null 2>&1; then
    dpkg-query -W -f='${Status} ${Version}\n' qemu-guest-agent 2>/dev/null || echo "qemu-guest-agent package not installed"
fi
printf "\n"
echo "--- Virtio Guest Agent Channel ---"
if [ -c /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
    ls -l /dev/virtio-ports/org.qemu.guest_agent.0
else
    echo "QEMU Guest Agent virtio channel not detected"
fi
printf "\n"
echo "--- Recent Guest Agent Logs ---"
journalctl -u qemu-guest-agent -b -n 30 --no-pager 2>/dev/null || echo "QEMU Guest Agent journal unavailable"
printf "\n%.0s" {1..3}

# --- 8.5 VIRTIO DEVICES / DRIVERS ---
echo "8.5 VIRTIO DEVICES / DRIVERS"
echo "--- Virtio PCI Devices ---"
lspci 2>/dev/null | grep -Ei 'virtio|red hat' || echo "No virtio PCI devices detected"
printf "\n"
echo "--- Virtio Kernel Modules ---"
lsmod 2>/dev/null | grep -E 'virtio|9pnet_virtio' || echo "No loaded virtio modules detected"
printf "\n"
echo "--- Balloon Driver ---"
lsmod 2>/dev/null | grep -E 'virtio_balloon|vmw_balloon|hv_balloon' || echo "No virtual memory balloon driver detected"
printf "\n%.0s" {1..3}

# --- 8.6 VMWARE TOOLS ---
echo "8.6 VMWARE TOOLS"
echo "open-vm-tools: $(systemctl is-active open-vm-tools 2>/dev/null || echo inactive/not-installed)"
echo "vmtoolsd     : $(systemctl is-active vmtoolsd 2>/dev/null || echo inactive/not-installed)"
printf "\n"
echo "--- VMware Tools Processes ---"
pgrep -a vmtoolsd 2>/dev/null || echo "vmtoolsd process not running"
printf "\n"
echo "--- VMware Tools Version ---"
if command -v vmware-toolbox-cmd >/dev/null 2>&1; then
    vmware-toolbox-cmd -v 2>/dev/null || echo "Unable to retrieve VMware Tools version"
else
    echo "vmware-toolbox-cmd not installed"
fi
printf "\n"
echo "--- VMware Kernel Drivers ---"
lsmod 2>/dev/null | grep -E 'vmw_|vmxnet|vsock' || echo "No VMware-specific modules detected"
printf "\n%.0s" {1..3}

# --- 8.7 HYPER-V INTEGRATION SERVICES ---
echo "8.7 HYPER-V INTEGRATION SERVICES"
echo "hv-kvp-daemon  : $(systemctl is-active hv-kvp-daemon 2>/dev/null || echo inactive/not-installed)"
echo "hv-vss-daemon  : $(systemctl is-active hv-vss-daemon 2>/dev/null || echo inactive/not-installed)"
echo "hv-fcopy-daemon: $(systemctl is-active hv-fcopy-daemon 2>/dev/null || echo inactive/not-installed)"
printf "\n"
echo "--- Hyper-V Kernel Modules ---"
lsmod 2>/dev/null | grep -E '^hv_|hv_vmbus|hv_netvsc|hv_storvsc|hv_utils|hv_balloon' || echo "No Hyper-V kernel modules detected"
printf "\n"
echo "--- Hyper-V Devices ---"
find /sys/bus/vmbus/devices -maxdepth 1 -mindepth 1 -type l 2>/dev/null | head -30 || echo "No VMBus devices detected"
printf "\n%.0s" {1..3}

# --- 8.8 LIBVIRT / QEMU HOST ---
echo "8.8 LIBVIRT / QEMU HOST"
echo "libvirtd  : $(systemctl is-active libvirtd 2>/dev/null || echo inactive/not-installed)"
echo "virtqemud : $(systemctl is-active virtqemud 2>/dev/null || echo inactive/not-installed)"
echo "virtlogd  : $(systemctl is-active virtlogd 2>/dev/null || echo inactive/not-installed)"
echo "virtlockd : $(systemctl is-active virtlockd 2>/dev/null || echo inactive/not-installed)"
printf "\n"
if command -v virsh >/dev/null 2>&1; then
    echo "--- Libvirt Version ---"
    virsh version 2>/dev/null || echo "Unable to query libvirt version"
    printf "\n"
    echo "--- Defined Virtual Machines ---"
    timeout 5 virsh list --all 2>/dev/null || echo "Unable to query libvirt domains"
else
    echo "virsh not installed"
fi
printf "\n%.0s" {1..3}

# --- 8.9 PROXMOX VE INFORMATION ---
echo "8.9 PROXMOX VE INFORMATION"
if command -v pveversion >/dev/null 2>&1; then
    echo "--- Proxmox VE Version ---"
    pveversion -v 2>/dev/null | head -40
    printf "\n"
    echo "--- Cluster Status ---"
    timeout 5 pvecm status 2>/dev/null | head -40 || echo "PVE cluster status unavailable or node is standalone"
    printf "\n"
    echo "--- Node Status ---"
    timeout 5 pvesh get /nodes --output-format yaml 2>/dev/null | head -50 || echo "PVE node API status unavailable"
    printf "\n"
    echo "--- Virtual Machines ---"
    qm list 2>/dev/null || echo "No QEMU virtual machines or qm unavailable"
    printf "\n"
    echo "--- LXC Containers ---"
    pct list 2>/dev/null || echo "No LXC containers or pct unavailable"
    printf "\n"
    echo "--- PVE Storage ---"
    pvesm status 2>/dev/null || echo "PVE storage status unavailable"
else
    echo "Proxmox VE tools not detected"
fi
printf "\n%.0s" {1..3}

# --- 8.10 PROXMOX BACKUP SERVER ---
echo "8.10 PROXMOX BACKUP SERVER"
if command -v proxmox-backup-manager >/dev/null 2>&1; then
    echo "--- PBS Version ---"
    proxmox-backup-manager version 2>/dev/null || dpkg-query -W 'proxmox-backup*' 2>/dev/null
    printf "\n"
    echo "--- PBS Services ---"
    echo "proxmox-backup       : $(systemctl is-active proxmox-backup 2>/dev/null || echo inactive/not-installed)"
    echo "proxmox-backup-proxy : $(systemctl is-active proxmox-backup-proxy 2>/dev/null || echo inactive/not-installed)"
    printf "\n"
    echo "--- Datastores ---"
    proxmox-backup-manager datastore list 2>/dev/null || echo "PBS datastore information unavailable"
else
    echo "Proxmox Backup Server tools not detected"
fi
printf "\n%.0s" {1..3}

# --- 8.11 LXC / SYSTEMD-NSPAWN CONTAINERS ---
echo "8.11 LXC / SYSTEMD-NSPAWN CONTAINERS"
echo "lxc      : $(systemctl is-active lxc 2>/dev/null || echo inactive/not-installed)"
echo "lxcfs    : $(systemctl is-active lxcfs 2>/dev/null || echo inactive/not-installed)"
echo "machines : $(systemctl is-active systemd-machined 2>/dev/null || echo inactive/not-installed)"
printf "\n"
if command -v lxc-ls >/dev/null 2>&1; then
    echo "--- LXC Containers ---"
    lxc-ls --fancy 2>/dev/null || echo "Unable to query LXC containers"
fi
printf "\n"
if command -v machinectl >/dev/null 2>&1; then
    echo "--- systemd Machines ---"
    machinectl list --no-pager 2>/dev/null || echo "No systemd-nspawn machines detected"
fi
printf "\n%.0s" {1..3}

# --- 8.12 DOCKER / PODMAN / CONTAINERD ---
echo "8.12 DOCKER / PODMAN / CONTAINERD"
echo "docker:     $(systemctl is-active docker 2>/dev/null || echo inactive/not-installed)"
echo "podman:     $(systemctl is-active podman 2>/dev/null || echo inactive/not-installed)"
echo "containerd: $(systemctl is-active containerd 2>/dev/null || echo inactive/not-installed)"
echo "cri-o:      $(systemctl is-active crio 2>/dev/null || echo inactive/not-installed)"
printf "\n"
if command -v docker >/dev/null 2>&1; then
    echo "--- Docker Containers ---"
    timeout 5 docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" 2>/dev/null | head -40 || echo "Docker daemon unavailable or access denied"
fi
printf "\n"
if command -v podman >/dev/null 2>&1; then
    echo "--- Podman Containers ---"
    timeout 5 podman ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" 2>/dev/null | head -40 || echo "Podman unavailable or access denied"
fi
printf "\n"
if command -v ctr >/dev/null 2>&1; then
    echo "--- containerd Namespaces ---"
    timeout 5 ctr namespaces list 2>/dev/null || echo "containerd socket unavailable or access denied"
fi
printf "\n%.0s" {1..3}

# --- 8.13 CLOUD-INIT ---
echo "8.13 CLOUD-INIT"
echo "cloud-init: $(systemctl is-active cloud-init 2>/dev/null || echo inactive/not-installed)"
printf "\n"
if command -v cloud-init >/dev/null 2>&1; then
    echo "--- Cloud-init Status ---"
    cloud-init status --long 2>/dev/null || echo "Unable to query cloud-init status"
    printf "\n"

echo "--- Cloud-init Data Source ---"

grep -R \
    'DataSource' \
    /run/cloud-init/ \
    2>/dev/null | \
    head -20 || \
    echo "Cloud-init data source not detected"
else
    echo "cloud-init not installed"
fi

printf "\n%.0s" {1..3}

# --- 8.14 VIRTUAL NETWORK BRIDGES ---

echo "8.14 VIRTUAL NETWORK BRIDGES"

echo "--- Linux Bridges ---"

ip -br link show type bridge 2>/dev/null || \
    echo "No Linux bridge interfaces detected"

printf "\n"

echo "--- Bridge Members ---"

bridge link 2>/dev/null || \
    echo "Bridge membership information unavailable"

printf "\n"

echo "--- Common Virtual Interfaces ---"

ip -br link 2>/dev/null | \
    grep -Ei \
        'vmbr|virbr|vnet|tap|fwbr|fwln|fwpr|docker|br-|cni|flannel|veth' || \
    echo "No common virtual interfaces detected"

printf "\n%.0s" {1..3}

# --- 8.15 GUEST / CONTAINER PROCESSES ---

echo "8.15 GUEST / CONTAINER PROCESSES"

ps -eo \
    pid,ppid,user,%cpu,%mem,stat,etime,cmd \
    2>/dev/null | \
    grep -Ei \
        'qemu-system|kvm|qemu-kvm|lxc-start|lxc-monitor|vboxheadless|vmware-vmx|containerd-shim|dockerd|podman|conmon' | \
    grep -v grep | \
    head -60 || \
    echo "No active guest or container runtime processes detected"