35f658b573
Collapse the three former check types into a single core `Monitor` entity
with one management surface (/monitors), one result table (monitor_results),
and a single scheduled task. Every type can now watch a free-standing custom
destination (optional host_id) — not just a registered Host.
- models: Monitor + MonitorResult replace PingResult/DnsResult; Host loses its
ping/dns facet columns (now Monitor rows linked by host_id).
- checks: monitors/{ping,dns,http}.py pure probes + runner.run_monitor
dispatcher; one monitor_check scheduler with a per-monitor due-filter.
- status: single monitor_status_source replaces the three sources.
- UI: /monitors blueprint (type-aware add/edit/list/widget); host hub shows a
host's linked monitors + "add monitor for this host"; nav + widget registry
+ alert metric catalog rewired. http plugin folded into core and removed.
- migration 0022 merges the http branch, data-migrates host facets +
http_monitors + all three result histories, drops the old tables/columns.
Resolves the per-host ping/dns auto-attach issue (#275): monitors are now
explicit, never auto-added to every host.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Jg27rgypiW2efULXJDtMC
48 lines
1.9 KiB
HTML
48 lines
1.9 KiB
HTML
{# hosts/uptime_widget.html — dashboard widget: SLA uptime summary #}
|
|
{% if not hosts %}
|
|
<div style="color:var(--text-muted);font-size:0.85rem;padding:0.5rem 0;">
|
|
No hosts configured.
|
|
</div>
|
|
{% else %}
|
|
|
|
<div style="display:grid;gap:2px;">
|
|
<div style="display:grid;grid-template-columns:1fr 52px 52px 52px;gap:0.35rem;font-size:0.72rem;color:var(--text-dim);padding:0 0 0.25rem;border-bottom:1px solid var(--border);">
|
|
<span>Host</span>
|
|
<span style="text-align:center;">24h</span>
|
|
<span style="text-align:center;">7d</span>
|
|
<span style="text-align:center;">30d</span>
|
|
</div>
|
|
{% for host in hosts %}
|
|
{% set ut = uptime.get(host.id, {}) %}
|
|
<div style="display:grid;grid-template-columns:1fr 52px 52px 52px;gap:0.35rem;align-items:center;padding:0.15rem 0;font-size:0.82rem;">
|
|
{% if session.user_id %}
|
|
<a href="/hosts/{{ host.id }}" title="{{ host.name }}"
|
|
style="overflow-wrap:anywhere;color:inherit;text-decoration:none;">{{ host.name }}</a>
|
|
{% else %}
|
|
<span style="overflow-wrap:anywhere;" title="{{ host.name }}">{{ host.name }}</span>
|
|
{% endif %}
|
|
{% for window in ["24h", "7d", "30d"] %}
|
|
{% set pct = ut.get(window) %}
|
|
<span style="text-align:center;font-family:ui-monospace,monospace;font-size:0.78rem;">
|
|
{% if pct is none %}
|
|
<span style="color:var(--text-dim);">—</span>
|
|
{% else %}
|
|
{# Configurable uptime thresholds (Settings → Thresholds); a normal value
|
|
(no degraded style) stays green to read as healthy at a glance. #}
|
|
{% set us = threshold_style(pct, 'uptime') %}
|
|
<span style="{{ us if us else 'color:var(--green);' }}">{{ "%.1f"|format(pct) }}%</span>
|
|
{% endif %}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if share_token %}
|
|
<div style="margin-top:0.5rem;text-align:right;">
|
|
<a href="/hosts/uptime" style="font-size:0.75rem;color:var(--text-muted);">Full SLA →</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endif %}
|