{# host_agent widget — fleet glance. One horizontal row per host, zebra-striped so adjacent hosts read as distinct groupings: health dot + host name on the left, metric cells (cpu/mem/disk/load) each with a trend sparkline laid out horizontally on the right. The name wraps (never hard-truncated) but the row stays horizontal. #} {% from "_macros.html" import metric_style %} {% if rows %} {% macro metric_cell(label, value, fmt, svg, style="", title="") %}
{{ label }}
{% if value is not none %}{{ fmt|format(value) }}{% else %}—{% endif %}
{{ svg | safe }}
{% endmacro %}
{% for r in rows %} {% set stale = r.stale %}
{# Left — health dot + full host name (wraps, never truncated) + last seen #}
{% if session.user_id %} {{ r.host.name }} {% else %} {{ r.host.name }} {% endif %} {{ r.reg.last_seen_at.strftime("%H:%M:%S") if r.reg.last_seen_at else "never" }}
{# Right — metric cells with value + trend, laid out horizontally #}
{{ metric_cell("cpu", r.cpu_pct, "%.0f%%", r.sparks.cpu, metric_style(r.cpu_pct), "Average CPU utilization") }} {{ metric_cell("mem", r.mem_used_pct, "%.0f%%", r.sparks.mem, metric_style(r.mem_used_pct), "Memory in use") }} {{ metric_cell("disk /", r.disk_root, "%.0f%%", r.sparks.disk, metric_style(r.disk_root), "Root filesystem (/) usage") }} {{ metric_cell("load", r.load_1m, "%.2f", r.sparks.load, "", "Load average (1m)") }}
{% endfor %}
{% else %}

No hosts with agent data yet.

{% endif %}