{# alerts/widget.html — the dashboard Alerts widget (#5510), in the widget shape (snippet #5259): a verdict; what is firing or silent, its reading now against what the rule fires on, and since when; then what someone has acknowledged, by whom and when; a line when alert email is failing or retrying; the quiet rules counted. Rows come from alert_svc.active_rows, so they read in the Alerts page's order. #} {% from "_macros.html" import status_dot %} {% set firing = rows|selectattr("label", "equalto", "firing")|list|length %} {% if not total and not rows %}
No alert rules yet.{% if session.user_role in ('operator', 'admin') %} Add a rule →{% endif %}
{% else %}
{%- if firing %}{{ firing }} firing{% else %}Nothing firing{% endif %} {%- for key, word in (("no_data", "silent"), ("acknowledged", "acknowledged"), ("pending", "pending")) %} {%- set n = rows|selectattr("label", "equalto", key)|list|length %} {%- if n %}, {{ n }} {{ word }}{% endif %} {%- endfor %} {%- if not rows %}: {{ "the rule is" if total == 1 else "all " ~ total ~ " rules are" }} quiet{% endif %}.
{% if rows %} {% for r in rows %} {% set rule = r.rule %} {% endfor %}
AlertNowSince
{{- status_dot(r.label) -}} {% if session.user_id %}{{ rule.name }}{% else %}{{ rule.name }}{% endif %} {%- if r.label == "acknowledged" %} {{ rule.resource_name }} · acknowledged{% if r.acked_by %} by {{ r.acked_by }}{% endif %}{% if r.state.acknowledged_at %} {{ r.state.acknowledged_at|ago }}{% endif %} {%- elif r.label == "no_data" %} {{ rule.resource_name }} · no reading {%- else %} {{ rule.resource_name }} · fires on {{ r.condition }} {%- endif %} {%- if r.label == "no_data" %}—{% else %}{{ metric_value(rule.metric_name, r.value) }}{% endif -%} {% if r.since %}{{ r.since|ago }}{% else %}—{% endif %}
{% endif %} {% if email.said %}
{{- email.said }}{% if session.user_role == "admin" %} — Outgoing email{% endif %}
{% endif %} {% if rows and quiet %}
+{{ quiet }} rule{{ "s" if quiet != 1 }} quiet{% if session.user_id %} — Alerts{% endif %}
{% endif %} {% endif %}