{# Current-state fragment for the full-metrics page — polled live via HTMX. Each poll re-renders the latest snapshot the server has. #} {% macro bar(pct) %} {%- set p = pct if pct is not none else 0 -%}
{% endmacro %} {# ── Identity / metadata ─────────────────────────────────────────────────── #}
{% if stale %}stale{% else %}live{% endif %} Address {{ host.address or "—" }} {% if reg %} {% if reg.distro %}OS {{ reg.distro }}{% endif %} {% if reg.kernel %}Kernel {{ reg.kernel }}{% endif %} {% if reg.arch %}Arch {{ reg.arch }}{% endif %} {% if reg.agent_version %}Agent v{{ reg.agent_version }}{% endif %} {% set up = hostlvl.get('uptime_secs') %} {% if up %}Uptime {{ up|duration }}{% endif %} Last seen {{ reg.last_seen_at.strftime("%Y-%m-%d %H:%M:%S") ~ " UTC" if reg.last_seen_at else "never" }} {% else %} No agent registration found for this host. {% endif %}
{% if not hostlvl %}
No metrics reported yet. Once the agent checks in, CPU, memory, network, disk I/O, temperatures, and pressure will appear here.
{% else %} {# ── Current headline gauges ─────────────────────────────────────────────── #}
CPU
{% set c = hostlvl.get('cpu_pct') %} {% if c is not none %}{{ "%.0f"|format(c) }}%{% else %}—{% endif %}
{{ bar(c) }}
Memory
{% set mp = hostlvl.get('mem_used_pct') %} {% if mp is not none %}{{ "%.0f"|format(mp) }}%{% else %}—{% endif %}
{{ bar(mp) }}
avail {{ hostlvl.get('mem_available_bytes')|bytes }} · cache {{ hostlvl.get('mem_cached_bytes')|bytes }} · swap {{ hostlvl.get('swap_used_bytes')|bytes }}
Load
{% if hostlvl.get('load_1m') is not none %}{{ "%.2f"|format(hostlvl.get('load_1m')) }}{% else %}—{% endif %}
5m {% if hostlvl.get('load_5m') is not none %}{{ "%.2f"|format(hostlvl.get('load_5m')) }}{% else %}—{% endif %} · 15m {% if hostlvl.get('load_15m') is not none %}{{ "%.2f"|format(hostlvl.get('load_15m')) }}{% else %}—{% endif %}
Network
↓ {{ hostlvl.get('net_rx_bps')|rate }}
↑ {{ hostlvl.get('net_tx_bps')|rate }}
Disk I/O
rd {{ hostlvl.get('disk_read_bps')|rate }}
wr {{ hostlvl.get('disk_write_bps')|rate }}
{% if hostlvl.get('temp_c_max') is not none %}
Temp (max)
{% set t = hostlvl.get('temp_c_max') %} {{ "%.0f"|format(t) }}°C
{% endif %} {% if hostlvl.get('psi_mem_some_avg10') is not none %}
Pressure (10s)
mem {{ "%.1f"|format(hostlvl.get('psi_mem_some_avg10')) }}%
{% if hostlvl.get('psi_cpu_some_avg10') is not none %}
cpu {{ "%.1f"|format(hostlvl.get('psi_cpu_some_avg10')) }}%
{% endif %} {% if hostlvl.get('psi_io_some_avg10') is not none %}
io {{ "%.1f"|format(hostlvl.get('psi_io_some_avg10')) }}%
{% endif %}
{% endif %}
{# ── Per-core CPU ─────────────────────────────────────────────────────────── #} {% if cores %}
Per-core CPU
{% for idx, pct in cores %}
core {{ idx }}{% if pct is not none %}{{ "%.0f"|format(pct) }}%{% else %}—{% endif %}
{{ bar(pct) }}
{% endfor %}
{% endif %} {# ── Filesystems ──────────────────────────────────────────────────────────── #} {% if mounts %}
Filesystems
{% for mount, m in mounts.items() %}
{{ mount }} {{ m.get('disk_used_bytes')|bytes }} / {{ m.get('disk_total_bytes')|bytes }}{% if m.get('disk_used_pct') is not none %} · {{ "%.0f"|format(m.get('disk_used_pct')) }}%{% endif %}
{{ bar(m.get('disk_used_pct')) }}
{% endfor %}
{% endif %} {# ── Interfaces / disks (short panels, side by side at natural height) ─────── #} {% if nets or disks_io %}
{% if nets %}
Interfaces
{% for iface, m in nets.items() %}
{{ iface }} ↓ {{ m.get('net_rx_bps')|rate }} · ↑ {{ m.get('net_tx_bps')|rate }}
{% endfor %}
{% endif %} {% if disks_io %}
Disks
{% for dev, m in disks_io.items() %}
{{ dev }} rd {{ m.get('disk_read_bps')|rate }} · wr {{ m.get('disk_write_bps')|rate }}
{% endfor %}
{% endif %}
{% endif %} {# ── Temperatures (full width; cores flow into a compact multi-column grid) ── #} {% if temps %}
Temperatures
{% for label, c in temps.items() %}
{{ label }} {% if c is not none %}{{ "%.0f"|format(c) }}°C{% else %}—{% endif %}
{% endfor %}
{% endif %} {% endif %}