diff --git a/plugins/host_agent/routes.py b/plugins/host_agent/routes.py index a377f71..a52167e 100644 --- a/plugins/host_agent/routes.py +++ b/plugins/host_agent/routes.py @@ -341,7 +341,10 @@ async def _fleet_rows(session) -> list[dict]: )).scalars().all() latest: dict[str, dict[str, float]] = {} + root_disk: dict[str, float] = {} # host_name → root (/) disk % for row in latest_rows: + if row.resource_name.endswith(":/") and row.metric_name == "disk_used_pct": + root_disk[row.resource_name[:-2]] = row.value if ":" in row.resource_name: continue latest.setdefault(row.resource_name, {})[row.metric_name] = row.value @@ -362,7 +365,8 @@ async def _fleet_rows(session) -> list[dict]: "stale": stale, "cpu_pct": m.get("cpu_pct"), "mem_used_pct": m.get("mem_used_pct"), - "disk_worst": m.get("disk_used_pct_worst"), + "disk_worst": m.get("disk_used_pct_worst"), # health dot only + "disk_root": root_disk.get(host.name), # displayed at-a-glance "load_1m": m.get("load_1m"), "temp_max": m.get("temp_c_max"), "net_rx_bps": m.get("net_rx_bps"), @@ -547,6 +551,9 @@ async def host_panel(host_id: str): AnsibleTarget.host_id == host_id))).scalar_one_or_none() hostlvl = latest.get(host.name, {}) + # At-a-glance disk = the root filesystem (what people actually care about), + # not the "worst" mount which is opaque. Worst stays on the full-metrics page. + disk_root = (latest.get(host.name + ":/", {}) or {}).get("disk_used_pct") ls = reg.last_seen_at if reg else None # "Deployed" is gated on the agent actually checking in (last_seen_at), NOT on # the registration row — that row is minted before the playbook runs, so a @@ -557,7 +564,8 @@ async def host_panel(host_id: str): ansible_cfg = current_app.config.get("ANSIBLE", {}) return await render_template( "panel.html", - host=host, reg=reg, hostlvl=hostlvl, reporting=reporting, stale=stale, target=target, + host=host, reg=reg, hostlvl=hostlvl, disk_root=disk_root, + reporting=reporting, stale=stale, target=target, ansible_available=has_capability("ansible.run_playbook"), managed_key_set=bool((ansible_cfg.get("ssh_public_key") or "").strip()), ) diff --git a/plugins/host_agent/templates/panel.html b/plugins/host_agent/templates/panel.html index 5279945..0c7d866 100644 --- a/plugins/host_agent/templates/panel.html +++ b/plugins/host_agent/templates/panel.html @@ -18,15 +18,18 @@
{% set cpu = hostlvl.get('cpu_pct') %} {% set mem = hostlvl.get('mem_used_pct') %} - {% set disk = hostlvl.get('disk_used_pct_worst') %} {% set load1 = hostlvl.get('load_1m') %} -
CPU
+
+
CPU
{{ '%.0f%%'|format(cpu) if cpu is not none else '—' }}
-
Memory
+
+
Memory
{{ '%.0f%%'|format(mem) if mem is not none else '—' }}
-
Disk (worst)
-
{{ '%.0f%%'|format(disk) if disk is not none else '—' }}
-
Load 1m
+
+
Disk /
+
{{ '%.0f%%'|format(disk_root) if disk_root is not none else '—' }}
+
+
Load 1m
{{ '%.2f'|format(load1) if load1 is not none else '—' }}
diff --git a/plugins/host_agent/templates/widget_table.html b/plugins/host_agent/templates/widget_table.html index c391b0c..1250740 100644 --- a/plugins/host_agent/templates/widget_table.html +++ b/plugins/host_agent/templates/widget_table.html @@ -16,8 +16,8 @@ {% if r.mem_used_pct is not none %} mem {{ "%.0f"|format(r.mem_used_pct) }}% {% endif %} - {% if r.disk_worst is not none %} - disk {{ "%.0f"|format(r.disk_worst) }}% + {% if r.disk_root is not none %} + disk / {{ "%.0f"|format(r.disk_root) }}% {% endif %} {% if r.load_1m is not none %} load {{ "%.2f"|format(r.load_1m) }}