{% extends "base.html" %} {% block title %}Alerts — Steward{% endblock %} {% from "_macros.html" import page_header, status_badge, empty_state %} {% block content %} {% set can_edit = session.user_role in ('operator', 'admin') %} {% call page_header("Alerts", "What is breaching now, in a sentence each, then every rule.") %} History Maintenance {% if can_edit %}New rule{% endif %} {% endcall %} {% if active %}

Active

{% for row in active %} {% endfor %}
State What is wrong Rule
{{ status_badge(row.label, title=("No sample since " ~ (row.state.last_sample_at.strftime('%Y-%m-%d %H:%M UTC') if row.state.last_sample_at else 'the rule started watching')) if row.label == 'no_data' else none) }} {% if row.state.no_data_since and row.label != 'no_data' %} {{ status_badge('no_data', title="Silent since " ~ row.state.no_data_since.strftime('%Y-%m-%d %H:%M UTC')) }} {% endif %} {{- row.says.lead -}} {%- if row.url %}{{ row.says.resource }}{% else %}{{ row.says.resource }}{% endif -%} {{- row.says.tail -}} {{ row.rule.name }} {% if can_edit and row.state.state.value == 'firing' %}
{{ csrf_field() }}
{% endif %}
{% else %}
{{ empty_state("No active alerts. Every rule is quiet.") }}
{% endif %}

Rules

{% if rules %}
{% for rule in rules %} {% endfor %}
Name Condition Fire / clear
{{ rule.name }} {% if not rule.enabled %} disabled {% endif %} {{ rule.source_module }}/{{ rule.resource_name }} :{{ rule.metric_name }} {{ rule.operator.value }} {{ rule.threshold }} {{ rule.consecutive_failures_required }} / {{ rule.consecutive_ok_required }} History {% if can_edit %} Edit
{{ csrf_field() }}
{% endif %} {% if session.user_role == 'admin' %}
{{ csrf_field() }}
{% endif %}
{% else %}
{{ empty_state("No alert rules yet.", "New rule" if can_edit else none, "/alerts/rules/new" if can_edit else none) }}
{% endif %} {% endblock %}