{% extends "base.html" %} {% from "_macros.html" import crumbs, page_header, stat_tile, status_badge, icon_button, empty_state %} {# One monitor: its state and since when, latency and uptime against Settings → Thresholds, its last checks, and the failures behind them. #} {% block title %}{{ monitor.name }} — Monitors — Steward{% endblock %} {% block breadcrumb %}{{ crumbs([("Monitors", "/monitors/"), (monitor.name, "")]) }}{% endblock %} {% block content %} {% set can_edit = session.user_role in ['operator', 'admin'] %} {% call page_header(monitor.name, (monitor.type|monitor_type) ~ " · " ~ monitor.target) %} {% if can_edit %} {{ icon_button("✎", "Edit " ~ monitor.name, href="/monitors/" ~ monitor.id ~ "/edit") }}
{{ csrf_field() }} {{ icon_button("⏸" if monitor.enabled else "▶", ("Pause " if monitor.enabled else "Resume ") ~ monitor.name, type="submit") }}
{{ csrf_field() }} {{ icon_button("×", "Delete " ~ monitor.name, type="submit", cls="btn-danger", confirm="Delete monitor " ~ monitor.name ~ "? Its check history goes with it.") }}
{% endif %} {% endcall %}
{% set since_hint = ((("for at least " if since_at_least else "since ") ~ since|ago) if since and state in ("up", "down", "degraded") else none) %} {{ stat_tile("State", status_info(state)[1], state=state, hint=since_hint) }} {% if latest and latest.response_ms is not none %} {{ stat_tile("Latency", "%.0f ms"|format(latest.response_ms), state=status_class(latest.response_ms, "latency")) }} {% endif %} {% for window in ("24h", "7d", "30d") %} {% set pct = uptime.get(window) %} {{ stat_tile("Uptime " ~ window, "%.2f%%"|format(pct) if pct is not none else "—", state=status_class(pct, "uptime")) }} {% endfor %} {% if tls_days is not none %} {{ stat_tile("TLS certificate", "expired" if tls_days < 0 else (tls_days|round|int) ~ " days", state="crit" if tls_days < 0 else status_class(tls_days, "tls_days")) }} {% endif %}

Last checks

{% if heartbeat %}
{% for _ in range([30 - heartbeat|length, 0]|max) %}{% endfor %} {% for h in heartbeat %}{% endfor %}

Newest on the right.{% if latest %} Last checked {{ latest.checked_at|ago }}.{% endif %}

{% else %} {{ empty_state("Not checked yet. The first check runs on the next scheduler tick." if monitor.enabled else "Paused, and never checked.") }} {% endif %}

Recent failures

{% if failures %} {% if monitor.type == "http" %}{% endif %} {% for f in failures %} {% if monitor.type == "http" %}{% endif %} {% endfor %}
WhenErrorStatus
{{ f.checked_at|ago }} {{ f.error_msg or "Down" }}{{ f.status_code or "—" }}
{% else %} {{ empty_state("No failed checks on record.") }} {% endif %}

Settings

Checked every
{{ monitor.check_interval_seconds|duration if monitor.check_interval_seconds else "the global interval" }}
{% if host %}
Host
{{ host.name }}
{% endif %} {% for key, value in monitor.config.items() %} {% if value not in (none, "", {}) %}
{{ key|replace("_", " ")|capitalize }}
{{ value|join(", ") if value is mapping else ("yes" if value is sameas true else ("no" if value is sameas false else value)) }}
{% endif %} {% endfor %}
{% endblock %}