Add Proxmox platform detection, preserve expanded card state across auto-refresh
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user