#5254 "Traefik — Routers: current routers only, header row, certs on the router they serve". - Router hosts come from Traefik's API (/api/http|tcp/routers), read best-effort on each scrape. An optional api_url overrides it; the default is /api on the metrics host. A certificate's expiry then shows in a TLS column on the router whose host it covers. An expiring one makes that router a problem, graded by Settings → Thresholds. - Only current: routers and certificates must have appeared in the last three scrapes. Certificates are upserted by serial and never deleted, so renewed or retired ones lingered on the widget. - Widget order: verdict, problem routers with the reason, then the busiest healthy routers under one header (Router / Req/s / Bandwidth / p95 / TLS). A missing value shows "—". - If the API is unreachable, expiring certificates are listed after the routers, not above them. - The page splits certificates into served (with the routers using each, plus SANs) and "No longer served". - Latest row per router: an index walk (recursive CTE + LATERAL) replaces DISTINCT plus a query per router. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
3.1 KiB
HTML
56 lines
3.1 KiB
HTML
{# plugins/traefik/templates/traefik/widget.html — the dashboard Routers widget
|
|
(#5254): a verdict, routers in trouble with why, then the busiest healthy
|
|
ones, under one header. Only routers Traefik still reports. A certificate
|
|
shows on the router it serves (TLS column, days left); when Traefik's API
|
|
can't say which hosts a router serves, the expiring certificates are listed
|
|
after the routers instead. #}
|
|
{% from "_macros.html" import status_dot %}
|
|
{% if not total %}
|
|
<div class="w-verdict" style="color:var(--text-muted);">No Traefik data yet.</div>
|
|
{% else %}
|
|
{% set crit = problems | selectattr("state", "equalto", "crit") | list %}
|
|
<div class="w-verdict {{ 'tone-crit' if crit else ('tone-warn' if problems or loose_certs else 'tone-ok') }}">
|
|
{%- if problems|length == 1 %}{{ problems[0].name.split('@')[0] }}: {{ problems[0].why }}.
|
|
{%- elif problems %}{{ problems|length }} of {{ total }} routers need a look.
|
|
{%- else %}All {{ total }} router{{ 's' if total != 1 }} healthy{% if loose_certs %}; {{ loose_certs|length }} certificate{{ 's' if loose_certs|length != 1 }} expiring{% endif %}.{% endif -%}
|
|
</div>
|
|
<table class="w-table">
|
|
<colgroup><col><col style="width:4rem"><col class="w-wide-only" style="width:5.5rem"><col style="width:4.2rem">{% if domains_known %}<col style="width:4.5rem">{% endif %}</colgroup>
|
|
<thead><tr><th>Router</th><th>Req/s</th><th class="w-wide-only">Bandwidth</th><th>p95</th>{% if domains_known %}<th>TLS</th>{% endif %}</tr></thead>
|
|
<tbody>
|
|
{% for r in problems + healthy %}
|
|
{% set m = r.latest %}
|
|
<tr>
|
|
<td class="w-name" title="{{ r.name }}">
|
|
{{- status_dot(r.state) -}}
|
|
{{ r.name.split('@')[0] }}
|
|
{%- if r.why %}<span class="w-sub tone-{{ r.state }}">{{ r.why }}</span>{% endif %}
|
|
</td>
|
|
<td>{% if m.request_rate is none %}—{% else %}{{ "%.2f"|format(m.request_rate) }}{% endif %}</td>
|
|
<td class="w-wide-only">{% if m.response_bytes_rate is none %}—{% else %}{{ m.response_bytes_rate|rate }}{% endif %}</td>
|
|
<td style="{{ threshold_style(m.latency_p95_ms, 'latency') if m.latency_p95_ms is not none }}">
|
|
{%- if m.latency_p95_ms is none %}—{% else %}{{ "%.0f"|format(m.latency_p95_ms) }} ms{% endif -%}
|
|
</td>
|
|
{% if domains_known %}
|
|
<td {% if r.cert %}style="{{ threshold_style(r.cert.days, 'tls_days') }}" title="Certificate {{ r.cert.cn }}"{% endif %}>
|
|
{%- if r.cert %}{{ cert_left(r.cert.days) }}{% else %}—{% endif -%}
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% if healthy_more %}<div class="w-more">+{{ healthy_more }} more healthy{% if session.user_id %} · <a href="/plugins/traefik/">all routers</a>{% endif %}</div>{% endif %}
|
|
{% if loose_certs %}
|
|
<div class="w-section">Certificates expiring</div>
|
|
{% for c in loose_certs %}
|
|
<div class="w-item">
|
|
{{- status_dot(status_class(c.days, 'tls_days')) -}}
|
|
<span class="w-label" title="{{ c.cn }}">{{ c.cn }}</span>
|
|
<span class="w-meta" style="{{ threshold_style(c.days, 'tls_days') }}">{{ cert_left(c.days) }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
<div class="w-note">Traefik's API didn't say which hosts each router serves, so these can't be shown on their routers.</div>
|
|
{% endif %}
|
|
{% endif %}
|