{# status/widget.html — the dashboard Overview (#5213): everything that needs attention, across hosts, monitors and alerts, with since-times. The Monitors widget is the full list of checks; this is the summary. #} {% from "_macros.html" import status_badge %} {% set firing = alerts | selectattr("label", "in", ["firing", "no_data"]) | list %} {% set anomalies = anomalies or [] %}
{% if session.user_id %}{% endif %} {{ total_hosts }}host{{ '' if total_hosts == 1 else 's' }} {% if session.user_id %}{% endif %} Monitors {{ up }}up {{ down }}down {% if pending %}{{ pending }}pending{% endif %} {% if session.user_id %}{% endif %} Alerts {{ firing|length }}firing {% if session.user_id %}{% endif %}
{% set problems = entries | rejectattr("status", "equalto", "up") | list %} {% if not problems and not alerts and not anomalies %}
{% if entries %}✓ All {{ up }} monitors are up and no alert is firing.{% else %}No monitors configured, and no alert is firing.{% endif %}
{% else %}
{% for a in alerts[:6] %}
{{ status_badge(a.label) }} {% set nm_style = "flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" %} {% if session.user_id %} {{ a.rule.name }} {% else %}{{ a.rule.name }}{% endif %} {{ a.since|ago }}
{% endfor %} {% for e in problems[:8] %}
{{ status_badge(e.status) }} {% set nm_style = "flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" %} {# Link to the monitor's own detail view for logged-in users; plain text on the public share view. #} {% if session.user_id and e.detail_url %} {{ e.name }} {% else %} {{ e.name }} {% endif %} {{ e.kind|monitor_type }} {% if e.since %}{% if e.since_at_least %}over {% endif %}{{ e.since|ago }}{% endif %}
{% endfor %} {# Metric anomalies going on now (#5740): a warning each. #} {% for v in anomalies[:4] %}
{{ status_badge("anomaly") }} {% set nm_style = "flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" %} {% set nm = v.anomaly.resource_name ~ " · " ~ metric_label(v.anomaly.metric_name) %} {% if session.user_id %} {{ nm }} {% else %}{{ nm }}{% endif %} {{ v.anomaly.last_started_at|ago }}
{% endfor %} {# What didn't fit, each linking to its own list (#5510). #} {% set more_alerts, more_monitors = alerts|length - 6, problems|length - 8 %} {% if more_alerts > 0 or more_monitors > 0 %}
{%- if more_alerts > 0 %}{% if session.user_id %}+{{ more_alerts }} more alerts{% else %}+{{ more_alerts }} more alerts{% endif %}{% endif %} {%- if more_alerts > 0 and more_monitors > 0 %} · {% endif %} {%- if more_monitors > 0 %}{% if session.user_id %}+{{ more_monitors }} more monitors{% else %}+{{ more_monitors }} more monitors{% endif %}{% endif -%}
{% endif %}
{% endif %} {% if to_review %}
{% if session.user_id %}{{ to_review }} metric anomal{{ "y" if to_review == 1 else "ies" }} to review {% else %}{{ to_review }} metric anomal{{ "y" if to_review == 1 else "ies" }} to review{% endif %}
{% endif %}