{# plugins/prometheus/templates/prometheus/index.html — every scrape target, those not answering first, each saying what its newest scrape found: how many series it stored, or why it got nothing (milestone 506). #} {% extends "base.html" %} {% from "_macros.html" import page_header, status_badge, stat_tile, empty_state %} {% block title %}Prometheus — Steward{% endblock %} {% from "prometheus/_tabs.html" import prometheus_tabs %} {% block section_tabs %}{{ prometheus_tabs("targets") }}{% endblock %} {% block content %} {% set admin = session.user_role == 'admin' %} {% call page_header("Prometheus targets", (targets|length ~ " target" ~ ("s" if targets|length != 1 else "")) if targets else none) %} {% if admin %}Add target{% endif %} {% endcall %} {% if not targets %}
{{ empty_state("No targets yet. Add a service's /metrics address, and Steward scrapes it on a schedule so its numbers can be charted and alerted on.", "Add target" if admin else none, "/plugins/prometheus/targets/new") }}
{% endif %} {% for t in targets %}
{% if t.reach == 'up' %}{{ status_badge('up', 'Answering') }} {% elif t.reach == 'down' %}{{ status_badge('down', 'Not answering') }} {% elif t.reach == 'stale' %}{{ status_badge('stale', 'Not scraped') }} {% elif t.reach == 'off' %}{{ status_badge('stale', 'Turned off') }} {% else %}{{ status_badge('pending', 'Not scraped yet') }}{% endif %}

{{ t.name }}

{{ t.url }} Series {% if admin %}Edit{% endif %}
{% if t.reach == 'down' %}

{{ t.says }}

{%- if t.ok_at %}Last answered {{ t.ok_at|ago }}.{% else %}It has never answered.{% endif %} Tried {{ t.scraped_at|ago }}.

{% elif t.reach in ('stale', 'off') %}

{{ t.says }}{% if t.scraped_at %} Last scraped {{ t.scraped_at|ago }}.{% endif %}

{% elif t.reach == 'pending' %}

Not scraped yet: the first scrape runs within seconds of saving.

{% endif %} {% if t.reach == 'up' %}
{{ stat_tile("Series stored", t.kept) }} {{ stat_tile("Over the cap", t.capped, hint=("cap is " ~ t.cap) if t.capped else none) }} {{ stat_tile("Left out by filters", t.dropped) }} {{ stat_tile("Scrape time", (t.scrape_ms|round|int ~ " ms") if t.scrape_ms is not none else "—") }} {{ stat_tile("Every", t.interval|duration) }}
{% if t.capped %}

{{ t.capped }} series weren't stored: past the cap of {{ t.cap }}, or a name too long to store. {% if admin %}Narrow what's kept or raise the cap.{% endif %}

{% endif %} {% endif %}
{% endfor %} {% endblock %}