Report uptime from the agents, and stop the Integrations page overflowing a phone
Linux agent 8 and Windows agent 7 say how long the machine has been up; the server stores it (migration 0086) and shows it as Up for in the status strip (left out while offline) and Uptime on the server page. The Integrations header wraps and its button no longer squeezes, and .table-responsive is positioned so hidden text in scrolled-off columns cannot widen the page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d88a24b33a
commit
41fbbf3467
18 files changed
+9161
-10
No files matched your search
@@ -17,7 +17,7 @@ set -euo pipefail
|
||||
# 4 = also reports failed services, disk health (SMART) and ZFS pools, reads pacman, and can update itself when told to
|
||||
# 5 = also says what the machine is (maker, model, serial number), from the firmware, for the inventory
|
||||
# 6 = also says what it could not collect and why (no smartctl, no systemd, a package manager that failed ...), so the server can say what to fix
|
||||
AGENT_VERSION=7
|
||||
AGENT_VERSION=8
|
||||
|
||||
ENV_FILE="${ENV_FILE:-/etc/homelab-manager-agent.env}"
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
@@ -579,6 +579,13 @@ collect_system_info() {
|
||||
cpu_load_percent=$(awk -v l="$load1" -v c="$cpu_cores" 'BEGIN { printf "%.1f", (l/c)*100 }')
|
||||
fi
|
||||
|
||||
# How long the host has been up: the first figure in /proc/uptime, in seconds. null if it cannot be read.
|
||||
local uptime_seconds="null"
|
||||
if [[ -r /proc/uptime ]]; then
|
||||
uptime_seconds=$(awk '{ printf "%d", $1 }' /proc/uptime 2>/dev/null || true)
|
||||
[[ "$uptime_seconds" =~ ^[0-9]+$ ]] || uptime_seconds="null"
|
||||
fi
|
||||
|
||||
local mem_total=0 mem_used=0
|
||||
if command -v free >/dev/null 2>&1; then
|
||||
read -r mem_total mem_used < <(free -b | awk '/^Mem:/ {print $2, $3}')
|
||||
@@ -648,11 +655,13 @@ collect_system_info() {
|
||||
--argjson cpu_load_percent "$cpu_load_percent" \
|
||||
--argjson mem_total_bytes "${mem_total:-0}" \
|
||||
--argjson mem_used_bytes "${mem_used:-0}" \
|
||||
--argjson uptime_seconds "$uptime_seconds" \
|
||||
--argjson disks "$disks_json" \
|
||||
'{
|
||||
ip_addresses: $ip_addresses,
|
||||
cpu: { model: $cpu_model, cores: $cpu_cores, load_percent: $cpu_load_percent },
|
||||
memory: { total_bytes: $mem_total_bytes, used_bytes: $mem_used_bytes },
|
||||
uptime_seconds: $uptime_seconds,
|
||||
disks: $disks,
|
||||
listening_ports: $listening_ports,
|
||||
updates: $updates,
|
||||
|
||||
Reference in new issue
Block a user