Traefik: routers are graded from their latest scrape (router_state: crit on any real 5xx share, warn on p95 past the latency critical cutoff or a high 4xx share). Failing and slow routers lead as cards that say why; healthy ones fold into one table that stays open or shut across polls. Proxy counts are stat tiles; certificates are graded by Settings -> Thresholds (tls_days). UniFi: WAN health is a stat strip (latency graded by the thresholds), devices carry status dots, event categories and firewall actions are badges, the alarm count reuses .count-badge (renamed from .nav-count). SNMP: each device wears a status badge and its readings are stat tiles. Agent fleet: the table comes first, with a Status column (Reporting / Silent / Never reported, by the host page's stale_after_seconds), silent agents first, hosts linked, last seen as |ago. Audit: entries name their entity (one query per type, steward/audit/ service.py) and link it; something deleted since keeps the name its entry recorded and says "(deleted)". Tokens: charts read colours through chart-colors.js (stewardColor resolves a token to the rgb the browser computed; Chart.js defaults take the page's text and border colours), so host, history, Traefik and SNMP charts drop their hex. Template hex colours reach 0 (HEX_CEILING = 0), the last rgba pills go, and heavy weights (600/700/bold, 60 of them) become 500, the house pair being 400/500; a guard keeps templates there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
3.3 KiB
HTML
88 lines
3.3 KiB
HTML
{# plugins/unifi/templates/unifi/widget.html #}
|
|
|
|
{# Active alarms #}
|
|
{% for al in active_alarms %}
|
|
<div style="display:flex;justify-content:space-between;font-size:0.8rem;color:var(--red);padding:0.15rem 0;">
|
|
<span>⚠ {{ al.alarm_key }}</span>
|
|
<span style="color:var(--text-dim);font-size:0.75rem;">alarm</span>
|
|
</div>
|
|
{% endfor %}
|
|
{# Offline device alerts #}
|
|
{% for d in offline_devices %}
|
|
<div style="display:flex;justify-content:space-between;font-size:0.8rem;color:var(--red);padding:0.15rem 0;">
|
|
<span>⚠ {{ d.name or d.mac }}</span>
|
|
<span>offline</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% if active_alarms or offline_devices %}<div style="height:0.4rem;"></div>{% endif %}
|
|
|
|
{% if latest_wan %}
|
|
<div class="ping-row">
|
|
<div class="ping-meta">
|
|
<span class="ping-name" style="font-size:0.8rem;">WAN</span>
|
|
</div>
|
|
<div style="flex:1;display:flex;gap:1.5rem;font-size:0.82rem;font-variant-numeric:tabular-nums;">
|
|
<span style="color:{% if latest_wan.is_up %}var(--green){% else %}var(--red){% endif %};">
|
|
{% if latest_wan.is_up %}Up{% else %}Down{% endif %}
|
|
</span>
|
|
{% if latest_wan.latency_ms is not none %}
|
|
<span>
|
|
<span style="color:var(--text-muted);">lat</span>
|
|
<span style="margin-left:0.2rem;{% if latest_wan.latency_ms > 100 %}color:var(--red){% elif latest_wan.latency_ms > 50 %}color:var(--yellow){% endif %};">
|
|
{{ "%.0f"|format(latest_wan.latency_ms) }}ms
|
|
</span>
|
|
</span>
|
|
{% endif %}
|
|
{% if latest_wan.rx_bytes_rate is not none %}
|
|
<span>
|
|
<span style="color:var(--text-muted);">↓</span>
|
|
{% set bps = latest_wan.rx_bytes_rate %}
|
|
{{ bps|rate }}
|
|
</span>
|
|
<span>
|
|
<span style="color:var(--text-muted);">↑</span>
|
|
{% set bps = latest_wan.tx_bytes_rate %}
|
|
{{ bps|rate }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if latest_clients %}
|
|
<div class="ping-row">
|
|
<div class="ping-meta">
|
|
<span class="ping-name" style="font-size:0.8rem;">Clients</span>
|
|
</div>
|
|
<div style="flex:1;display:flex;gap:1rem;font-size:0.82rem;">
|
|
<span style="font-weight:500;">{{ latest_clients.total_clients }}</span>
|
|
<span style="color:var(--text-muted);">{{ latest_clients.wireless_clients }}w / {{ latest_clients.wired_clients }}e</span>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if top_clients %}
|
|
<div style="margin-top:0.4rem;border-top:1px solid var(--border);padding-top:0.4rem;">
|
|
{% for c in top_clients %}
|
|
<div class="ping-row" style="padding:0.1rem 0;">
|
|
<div class="ping-meta" style="min-width:0;flex:1;">
|
|
<span style="font-size:0.78rem;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ c.hostname }}</span>
|
|
</div>
|
|
<div style="font-size:0.78rem;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--text-muted);">
|
|
{% set total_bps = c.tx_rate + c.rx_rate %}
|
|
<span style="color:var(--text-muted);">↓</span>
|
|
{% set rx = c.rx_rate %}
|
|
{{ rx|rate }}
|
|
<span style="color:var(--text-muted);margin-left:0.4rem;">↑</span>
|
|
{% set tx = c.tx_rate %}
|
|
{{ tx|rate }}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not latest_wan and not latest_clients and not active_alarms and not offline_devices %}
|
|
<p class="empty" style="padding:0.5rem 0;font-size:0.85rem;">No UniFi data yet.</p>
|
|
{% endif %}
|