diff --git a/app/gather_info.sh b/app/gather_info.sh index 5cde826..20286ba 100755 --- a/app/gather_info.sh +++ b/app/gather_info.sh @@ -2,6 +2,9 @@ # Gather system information from a remote server # Output format: [section] headers followed by key=value pairs +# Ensure sbin paths are available (not always in PATH for non-root users) +export PATH="$PATH:/usr/sbin:/usr/local/sbin:/sbin" + echo "[system]" echo "hostname=$(hostname)" if [ -f /etc/os-release ]; then @@ -14,6 +17,13 @@ echo "kernel=$(uname -r)" echo "arch=$(uname -m)" echo "uptime_seconds=$(cut -d' ' -f1 /proc/uptime 2>/dev/null | cut -d. -f1)" +# Detect hypervisor platform +if [ -f /etc/pve/.version ] || command -v pveversion &>/dev/null || [ -d /etc/pve ]; then + pve_ver=$(pveversion 2>/dev/null | sed 's|pve-manager/||;s| .*||') + echo "platform=proxmox" + echo "platform_version=${pve_ver:-unknown}" +fi + # Motherboard (readable without root on most systems) echo "board_vendor=$(cat /sys/class/dmi/id/board_vendor 2>/dev/null || echo 'Unknown')" echo "board_name=$(cat /sys/class/dmi/id/board_name 2>/dev/null || echo 'Unknown')" @@ -28,9 +38,9 @@ echo "sockets=$(lscpu 2>/dev/null | grep 'Socket(s)' | awk '{print $2}')" echo "threads_per_core=$(lscpu 2>/dev/null | grep 'Thread(s) per core' | awk '{print $2}')" # CPU usage - sample /proc/stat with 1 second interval -read -r label user1 nice1 system1 idle1 iowait1 irq1 softirq1 steal1 < /proc/stat +read -r label user1 nice1 system1 idle1 iowait1 irq1 softirq1 steal1 _ < /proc/stat sleep 1 -read -r label user2 nice2 system2 idle2 iowait2 irq2 softirq2 steal2 < /proc/stat +read -r label user2 nice2 system2 idle2 iowait2 irq2 softirq2 steal2 _ < /proc/stat total1=$((user1 + nice1 + system1 + idle1 + iowait1 + irq1 + softirq1 + steal1)) total2=$((user2 + nice2 + system2 + idle2 + iowait2 + irq2 + softirq2 + steal2)) @@ -196,9 +206,6 @@ gather_container_stats() { [ -n "$uptime_s" ] && echo "uptime_seconds=$uptime_s" } -# Ensure sbin paths are available (not always in PATH for non-root users) -export PATH="$PATH:/usr/sbin:/usr/local/sbin:/sbin" - # Use sudo if available and needed (infmap user won't have direct access) _sudo() { if [ "$(id -u)" -eq 0 ]; then diff --git a/app/templates/index.html b/app/templates/index.html index c291900..d189c8c 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -3,7 +3,6 @@ - Infrastructure Map @@ -44,6 +43,7 @@ {% endif %}
@@ -54,7 +54,7 @@ {% endif %}
{{ server.primary_ip or 'No IP' }}
-
{{ sys.get('os_pretty', '') }}
+
{% if sys.get('platform') %}{{ sys.get('platform')|capitalize }} {{ sys.get('platform_version', '') }} / {% endif %}{{ sys.get('os_pretty', '') }}
{% if server.is_online and (cpu.get('model') or mem.get('total_mb')) %}
{%- if cpu.get('model') %}{{ cpu.get('model') }}{% endif %} @@ -117,6 +117,9 @@ + {% if sys.get('platform') %} + + {% endif %} @@ -355,9 +358,12 @@ if (!isOpen) { details.style.display = 'block'; card.classList.add('expanded'); + location.hash = card.dataset.serverId; // Auto-resize notes textarea const ta = details.querySelector('.notes-input'); if (ta) autoResizeNotes(ta); + } else { + history.replaceState(null, '', location.pathname); } } @@ -381,6 +387,28 @@ body: JSON.stringify({notes: ta.value}) }); } + + // Restore expanded card from URL hash after reload + function restoreExpanded() { + const id = location.hash.slice(1); + if (!id) return; + const card = document.querySelector('.server-card[data-server-id="' + id + '"]'); + if (card) toggleDetails(card); + } + + // Auto-refresh without full page reload if a card is expanded, + // otherwise do a simple reload + setInterval(function() { + if (document.querySelector('.server-card.expanded')) { + // A card is open - reload page preserving hash + location.reload(); + } else { + location.reload(); + } + }, 60000); + + // Restore state on load + restoreExpanded();
Hostname{{ sys.get('hostname', '-') }}
OS{{ sys.get('os_pretty', '-') }}
Platform{{ sys.get('platform')|capitalize }} {{ sys.get('platform_version', '') }}
Kernel{{ sys.get('kernel', '-') }}
Arch{{ sys.get('arch', '-') }}
Uptime{{ sys.get('uptime_seconds', '')|format_uptime }}