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>
52 lines
2.9 KiB
HTML
52 lines
2.9 KiB
HTML
{# Per-host SNMP fragment — embedded on the Hosts hub via HTMX. Self-contained.
|
|
Shows the SNMP device(s) whose address maps to this host + latest readings. #}
|
|
<div class="card">
|
|
<div style="display:flex;align-items:baseline;justify-content:space-between;margin-bottom:0.6rem;gap:1rem;flex-wrap:wrap;">
|
|
<h3 class="section-title" style="margin-bottom:0;">SNMP</h3>
|
|
<a href="/plugins/snmp/" style="font-size:0.8rem;color:var(--text-muted);">All devices →</a>
|
|
</div>
|
|
|
|
{% for device in devices %}
|
|
<div style="{% if not loop.last %}margin-bottom:1rem;{% endif %}">
|
|
<div style="display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;flex-wrap:wrap;">
|
|
<span style="font-weight:500;font-size:0.92rem;">{{ device.name }}</span>
|
|
<span style="font-size:0.78rem;color:var(--text-dim);font-family:ui-monospace,monospace;">{{ device.host }}</span>
|
|
{% if device.bound %}
|
|
<span title="Explicitly bound to this host (host_id / steward_host)"
|
|
style="font-size:0.68rem;color:var(--text-muted);background:var(--bg-elevated);border:1px solid var(--border);border-radius:3px;padding:0.05rem 0.4rem;">bound</span>
|
|
{% endif %}
|
|
{% if device.readings %}
|
|
<span style="font-size:0.74rem;color:var(--green);">● reachable</span>
|
|
{% else %}
|
|
<span style="font-size:0.74rem;color:var(--text-dim);">○ no data yet</span>
|
|
{% endif %}
|
|
<a href="/plugins/snmp/device/{{ device.name }}" class="btn btn-ghost btn-sm"
|
|
style="margin-left:auto;font-size:0.76rem;padding:0.15rem 0.55rem;">History</a>
|
|
</div>
|
|
|
|
{% if device.readings %}
|
|
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:0.5rem;">
|
|
{% for oid_cfg in device.oids %}
|
|
{% set label = oid_cfg.label if oid_cfg.label else oid_cfg.oid %}
|
|
{% set val = device.readings.get(label) %}
|
|
<div style="background:var(--bg-elevated);border-radius:5px;padding:0.5rem 0.7rem;border:1px solid var(--border);">
|
|
<div style="font-size:0.68rem;color:var(--text-dim);margin-bottom:0.2rem;font-family:ui-monospace,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ label }}</div>
|
|
{% if val is not none %}
|
|
<div style="font-size:1rem;font-weight:500;font-variant-numeric:tabular-nums;">
|
|
{% if val >= 1000000 %}{{ "%.2f"|format(val / 1000000) }}<span style="font-size:0.72rem;color:var(--text-muted);">M</span>
|
|
{% elif val >= 1000 %}{{ "%.1f"|format(val / 1000) }}<span style="font-size:0.72rem;color:var(--text-muted);">K</span>
|
|
{% else %}{{ "%.4g"|format(val) }}{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div style="font-size:0.85rem;color:var(--text-dim);">—</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p style="font-size:0.8rem;color:var(--text-dim);margin:0;">No readings yet — waiting for the next poll.</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|