{# hosts/overview_widget.html — the dashboard Hosts widget (#5251): a verdict, then one row per host, worst first, with its resources under one header. Load is shown against the host's cores and graded per core. CPU, memory and load within the host's own normal for the hour read healthy (#5742), with what is usual on hover. Reachability and uptime belong to the Monitors widget, so they aren't repeated here. #} {% from "_macros.html" import status_dot %} {% if not rows %}
No hosts yet.{% if session.user_id %} Add one →{% endif %}
{% else %} {% set problems = rows | selectattr("state", "in", ["down", "crit", "stale", "warn"]) | list %}
{%- if not problems %}All {{ rows|length }} host{{ 's' if rows|length != 1 }} healthy. {%- elif problems|length == 1 %}{% set p = problems[0] %}{{ p.host.name }}: {% if p.state == 'down' %}a monitor is down.{% elif p.state == 'stale' %}its agent stopped reporting.{% else %}{{ p.worst[0] }} high.{% endif %} {%- else %}{{ problems|length }} of {{ rows|length }} hosts need a look.{% endif -%}
{% for r in rows %} {% set a = r.agent %}{% set fresh = a.get('fresh') %} {% for v, kind in ((a.get('cpu_pct'), 'cpu'), (a.get('mem_used_pct'), 'mem'), (a.get('disk_root'), 'disk')) %} {% set g = (r.grades or {}).get(kind) or (none, none) %} {% set inodes = a.get('inodes_root') if kind == 'disk' else none %} {% endfor %} {% set g = (r.grades or {}).get('load') or (none, none) %} {% endfor %}
HostCPUMemDiskLoad
{{- status_dot(r.state) -}} {% if session.user_id %}{{ r.host.name }}{% else %}{{ r.host.name }}{% endif %} {%- if r.state == 'down' %}a monitor is down{% if r.down_since %} for {{ r.down_since|ago|replace(' ago', '') }}{% endif %} {%- elif r.state == 'stale' %}agent last reported {{ a.last_at|ago }}; figures are from then {%- elif not a %}no agent{% endif %} v) %} title="Inodes {{ '%.0f'|format(inodes) }}% used: no file can be created once they run out"{% endif %}>{% if v is none %}—{% else %}{{ "%.0f"|format(v) }}%{% endif %}{% if inodes is not none and (v is none or inodes > v) and inodes >= 80 %} inodes {{ "%.0f"|format(inodes) }}%{% endif %} {%- if a.get('load_1m') is none %}—{% elif a.get('cores') %}{{ "%.1f"|format(a.load_1m) }} / {{ a.cores }} cores{% else %}{{ "%.1f"|format(a.load_1m) }}{% endif -%}
{% endif %}