feat: maintenance windows, reports, uptime widget, alert improvements

- Add maintenance window scheduling to suppress alerts during planned
  downtime (model, routes, templates)
- Add weekly email/webhook reports with host summary (core/reports.py,
  Settings → Reports tab)
- Add host uptime history widget with per-check sparkline view
- Expand alert rules: dynamic metric catalog for plugin sources,
  per-rule HTMX field loading, maintenance window awareness
- Register additional dashboard widgets (uptime, SNMP, UniFi, UPS)
- Add Settings → Reports tab configuration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 08:15:30 -04:00
parent 3c70ac56b3
commit ced1eebe1d
17 changed files with 1286 additions and 84 deletions
+23 -11
View File
@@ -49,7 +49,10 @@
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;">
<h2 class="section-title">Rules</h2>
<a class="btn" href="/alerts/rules/new">New Rule</a>
<div style="display:flex;gap:0.5rem;">
<a class="btn btn-ghost" href="/alerts/maintenance">Maintenance</a>
<a class="btn" href="/alerts/rules/new">New Rule</a>
</div>
</div>
{% if rules %}
<div class="card-flush">
@@ -58,24 +61,33 @@
<tr>
<th>Name</th>
<th>Condition</th>
<th>Consec.</th>
<th>Enabled</th>
<th style="text-align:center;">Consec.</th>
<th></th>
</tr>
</thead>
<tbody>
{% for rule in rules %}
<tr>
<td>{{ rule.name }}</td>
<td style="color:var(--text-muted);">
{{ rule.source_module }}/{{ rule.resource_name }}:{{ rule.metric_name }}
{{ rule.operator.value }} {{ rule.threshold }}
</td>
<td style="color:var(--text-muted);">{{ rule.consecutive_failures_required }}</td>
<tr {% if not rule.enabled %}style="opacity:0.55;"{% endif %}>
<td>
{% if rule.enabled %}<span class="badge badge-green">yes</span>{% else %}<span class="badge badge-dim">no</span>{% endif %}
{{ rule.name }}
{% if not rule.enabled %}
<span style="font-size:0.72rem;color:var(--text-dim);margin-left:0.35rem;">disabled</span>
{% endif %}
</td>
<td style="color:var(--text-muted);font-size:0.85rem;">
<span style="color:var(--text-dim);">{{ rule.source_module }}/</span>{{ rule.resource_name }}
<span style="font-family:ui-monospace,monospace;font-size:0.8rem;">
:{{ rule.metric_name }} {{ rule.operator.value }} {{ rule.threshold }}
</span>
</td>
<td style="color:var(--text-muted);text-align:center;">{{ rule.consecutive_failures_required }}</td>
<td class="td-actions">
<a href="/alerts/rules/{{ rule.id }}/edit" class="btn btn-sm btn-ghost">Edit</a>
<form method="post" action="/alerts/rules/{{ rule.id }}/toggle" style="display:inline;">
<button type="submit" class="btn btn-sm btn-ghost">
{% if rule.enabled %}Disable{% else %}Enable{% endif %}
</button>
</form>
<form method="post" action="/alerts/rules/{{ rule.id }}/delete" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger"
onclick="return confirm('Delete rule {{ rule.name }}?')">Delete</button>