{# The Hosts table: the list page includes it, and the filter bar swaps it in alone (#5294). Problems first unless a column header picked another sort; groups are the linked Ansible target's (the Hosts system's ruling). #} {% from "_macros.html" import status_badge, sort_th %} {% macro pct(v, kind, stale) -%} {%- if v is none %}— {%- else %}{{ '%.0f'|format(v) }}%{% endif -%} {%- endmacro %} {% macro th(key, label, cls=none, title=none) -%} {{ sort_th(label, sort_url(key), active=f.sort == key, desc=f.dir == 'desc', cls=cls, title=title) }} {%- endmacro %} {% if hosts %}
{{ th("name", "Name") }} {% if group_names %}{% endif %} {{ th("status", "Status", title="Problems first: a down monitor, then an agent gone quiet, then monitors not yet checked") }} {{ th("latency", "Latency", "num", "Fastest latest response among this host's monitors") }} {{ th("uptime", "30d uptime", "num", "Uptime over 30 days across this host's monitors; hover a figure for 24h and 7d") }} {{ th("cpu", "CPU", "num", "Agent: CPU in use, latest reading") }} {{ th("mem", "Memory", "num", "Agent: memory in use, latest reading") }} {% for host in hosts %} {% set hs = host_status.get(host.id) %} {% set ut = uptime.get(host.id, {}) %} {% set am = agent.get(host.name) %} {% set silent = am and not am.fresh %} {% if group_names %} {% endif %} {% endfor %}
AddressGroupsMonitors
{{ host.name }} {{ host.address or "—" }} {%- for g in groups.get(host.id, []) %}{{ g }}{% else %}—{% endfor -%} {% if hs %} {{ status_badge(hs.state) }} {%- if hs.state == 'down' and hs.down_since %} for {{ hs.down_since|ago|striptags|replace(" ago", "") }}{% endif %} {% else %} — {% endif %} {% if silent %}
{{ status_badge('stale', label="agent silent", title="No agent report since " ~ (am.last_at.strftime('%Y-%m-%d %H:%M UTC') if am.last_at else 'it started')) }} {%- if am.last_at %} for {{ am.last_at|ago|striptags|replace(" ago", "") }}{% endif %}
{% endif %}
{% if hs and hs.latency_ms is not none %} {{ hs.latency_ms | round(1) }} ms {% else %}—{% endif %} {{ hs.count if hs else "—" }} {% if ut.get('30d') is none %}— {% else %}{{ "%.2f"|format(ut['30d']) }}%{% endif %} {% if am %}{{ pct(am.cpu_pct, 'cpu', silent) }}{% else %}—{% endif %} {% if am %}{{ pct(am.mem_used_pct, 'mem', silent) }}{% else %}—{% endif %}
{% else %}

No hosts match these filters. Show every host

{% endif %}