feat(settings): Settings brought into line with the rest of Steward (milestone 493)
The last page of #5214's walk. Settings still described Steward as it was before monitors were unified and SNMP was rebuilt, drew its tabs below the breadcrumb, and showed the report schedule in UTC. - Tabs (#5377): settings/_tabs.html is a settings_tabs() macro called in each page's section_tabs block, above the trail, as Ansible's are. The breadcrumb guard also fails any page that {% include %}s a tab strip. - Report time (#5378): reports.schedule_tz keeps the zone of whoever saved the schedule; check_and_send compares in it (report_due), and the form shows the day and hour on the reader's clock (schedule_in) under their zone's name. "Last sent" uses |when. - Wording (#5379): the report contents list what the report holds (monitors, not ping-enabled hosts); "Ping latency" is "Response time" and says what it grades; plugin detail says enabling loads now and disabling needs a restart; the monitor interval says it applies on the next check (the scheduler reads it every pass); the dead list-config branch is gone. - Traefik (#5380): the 5xx and 4xx cutoffs are settings (traefik.threshold.error_5xx_pct 0.1, error_4xx_pct 1.0) in a "Traefik routers" group on Thresholds while the plugin runs, read by router_state through error_cutoffs(). The Traefik page has a Thresholds button for admins, to /settings/thresholds/#traefik. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -213,8 +213,25 @@ async def send_report(app) -> tuple[bool, str]:
|
||||
return False, f"Send failed: {exc}"
|
||||
|
||||
|
||||
def report_due(now: datetime, day: int, hour: int, tz) -> bool:
|
||||
"""Whether `now` falls in the scheduled hour, read in the schedule's zone."""
|
||||
local = now.astimezone(tz)
|
||||
return local.weekday() == day and local.hour == hour
|
||||
|
||||
|
||||
def schedule_in(day: int, hour: int, saved_tz, view_tz, now: datetime | None = None) -> tuple[int, int]:
|
||||
"""The schedule's (weekday, hour) as a reader in `view_tz` sees it: the next
|
||||
time it falls due in `saved_tz`, read on their clock."""
|
||||
local = (now or datetime.now(timezone.utc)).astimezone(saved_tz)
|
||||
due = (local + timedelta(days=(day - local.weekday()) % 7)).replace(
|
||||
hour=hour, minute=0, second=0, microsecond=0)
|
||||
seen = due.astimezone(view_tz)
|
||||
return seen.weekday(), seen.hour
|
||||
|
||||
|
||||
async def check_and_send(app) -> None:
|
||||
"""Hourly scheduler hook: send if day/hour match and not sent recently."""
|
||||
from steward.core.formatting import zone
|
||||
from steward.core.settings import get_setting, set_setting
|
||||
|
||||
async with app.db_sessionmaker() as db:
|
||||
@@ -224,10 +241,11 @@ async def check_and_send(app) -> None:
|
||||
|
||||
schedule_day = int(await get_setting(db, "reports.schedule_day") or 6)
|
||||
schedule_hour = int(await get_setting(db, "reports.schedule_hour") or 8)
|
||||
schedule_tz = zone(await get_setting(db, "reports.schedule_tz"))
|
||||
last_sent_str = await get_setting(db, "reports.last_sent_at") or ""
|
||||
|
||||
now = datetime.now(timezone.utc)
|
||||
if now.weekday() != schedule_day or now.hour != schedule_hour:
|
||||
if not report_due(now, schedule_day, schedule_hour, schedule_tz):
|
||||
return
|
||||
|
||||
if last_sent_str:
|
||||
|
||||
@@ -83,6 +83,10 @@ DEFAULTS: dict[str, Any] = {
|
||||
"ansible.max_concurrent_runs": 3,
|
||||
"ping.threshold.good_ms": 50,
|
||||
"ping.threshold.warn_ms": 200,
|
||||
# A Traefik router serving more than this share of 5xx is failing; more
|
||||
# than this share of 4xx is worth a look (#5380).
|
||||
"traefik.threshold.error_5xx_pct": 0.1,
|
||||
"traefik.threshold.error_4xx_pct": 1.0,
|
||||
# Degraded/critical cutoffs for metric coloring (warn=amber, crit=red).
|
||||
# cpu/mem/disk/load are percentages (load is load-per-core %); temp in °C.
|
||||
# uptime is "higher is better" so its warn/crit are floors. Ping latency
|
||||
@@ -156,7 +160,10 @@ DEFAULTS: dict[str, Any] = {
|
||||
# Scheduled reports
|
||||
"reports.enabled": False,
|
||||
"reports.schedule_day": 6, # 0=Monday … 6=Sunday
|
||||
"reports.schedule_hour": 8, # UTC hour
|
||||
"reports.schedule_hour": 8, # an hour in reports.schedule_tz
|
||||
# The zone of whoever last saved the schedule (an IANA name; blank is UTC),
|
||||
# so "Sunday 08:00" means 08:00 where they are (#5378).
|
||||
"reports.schedule_tz": "",
|
||||
"reports.last_sent_at": "",
|
||||
}
|
||||
|
||||
@@ -452,6 +459,11 @@ def to_thresholds_cfg(settings: dict[str, Any]) -> dict:
|
||||
"tls_days": {"warn": g("thresholds.tls_warn_days", 14), "crit": g("thresholds.tls_crit_days", 3), "dir": "low"},
|
||||
"clock": {"warn": g("thresholds.clock_warn_s", 30), "crit": g("thresholds.clock_crit_s", 300), "dir": "high"},
|
||||
"crash_loop": {"warn": g("thresholds.crash_loop_deaths", 3), "crit": g("thresholds.crash_loop_deaths", 3), "dir": "high"},
|
||||
# One cutoff each: a router's 5xx share past it is crit, a 4xx share warn.
|
||||
"error_5xx": {"warn": g("traefik.threshold.error_5xx_pct", 0.1),
|
||||
"crit": g("traefik.threshold.error_5xx_pct", 0.1), "dir": "high"},
|
||||
"error_4xx": {"warn": g("traefik.threshold.error_4xx_pct", 1.0),
|
||||
"crit": g("traefik.threshold.error_4xx_pct", 1.0), "dir": "high"},
|
||||
}
|
||||
|
||||
|
||||
|
||||
+29
-10
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
import html
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from quart import Blueprint, current_app, render_template, request, redirect, url_for, session
|
||||
|
||||
@@ -140,6 +141,8 @@ _THRESHOLD_FIELDS = [
|
||||
("tls_warn", "thresholds.tls_warn_days", False), ("tls_crit", "thresholds.tls_crit_days", False),
|
||||
("clock_warn", "thresholds.clock_warn_s", False), ("clock_crit", "thresholds.clock_crit_s", False),
|
||||
("crash_loop_deaths", "thresholds.crash_loop_deaths", False),
|
||||
("error_5xx_pct", "traefik.threshold.error_5xx_pct", True),
|
||||
("error_4xx_pct", "traefik.threshold.error_4xx_pct", True),
|
||||
]
|
||||
|
||||
# Docker time-series retention windows (days). Read fresh by the cleanup task,
|
||||
@@ -159,7 +162,9 @@ _RETENTION_FIELDS = [
|
||||
async def thresholds():
|
||||
async with current_app.db_sessionmaker() as db:
|
||||
settings = await get_all_settings(db)
|
||||
return await render_template("settings/thresholds.html", settings=settings)
|
||||
from steward.core.plugin_manager import _LOADED_PLUGINS
|
||||
return await render_template("settings/thresholds.html", settings=settings,
|
||||
traefik_on="traefik" in _LOADED_PLUGINS)
|
||||
|
||||
|
||||
@settings_bp.post("/thresholds/")
|
||||
@@ -568,17 +573,36 @@ async def save_auth_settings():
|
||||
|
||||
# ── Reports ───────────────────────────────────────────────────────────────────
|
||||
|
||||
async def _reports_page(settings: dict, flash):
|
||||
"""Settings → Reports, with the schedule and the last send in the reader's
|
||||
zone: the hour is kept in the zone of whoever saved it (#5378)."""
|
||||
from steward.core.formatting import zone
|
||||
from steward.core.reports import schedule_in
|
||||
shown_day, shown_hour = schedule_in(
|
||||
int(settings.get("reports.schedule_day", 6)), int(settings.get("reports.schedule_hour", 8)),
|
||||
zone(settings.get("reports.schedule_tz")), zone(session.get("tz")))
|
||||
raw = settings.get("reports.last_sent_at") or ""
|
||||
try:
|
||||
last_sent = datetime.fromisoformat(raw) if raw else None
|
||||
except ValueError:
|
||||
last_sent = None
|
||||
return await render_template("settings/reports.html", settings=settings, flash=flash,
|
||||
shown_day=shown_day, shown_hour=shown_hour, last_sent=last_sent)
|
||||
|
||||
|
||||
@settings_bp.get("/reports/")
|
||||
@require_role(UserRole.admin)
|
||||
async def reports():
|
||||
async with current_app.db_sessionmaker() as db:
|
||||
settings = await get_all_settings(db)
|
||||
return await render_template("settings/reports.html", settings=settings, flash=None)
|
||||
return await _reports_page(settings, None)
|
||||
|
||||
|
||||
@settings_bp.post("/reports/")
|
||||
@require_role(UserRole.admin)
|
||||
async def save_reports():
|
||||
"""The day and hour are what the reader picked on their own clock, so the
|
||||
schedule is kept in their zone."""
|
||||
form = await request.form
|
||||
async with current_app.db_sessionmaker() as db:
|
||||
async with db.begin():
|
||||
@@ -587,6 +611,7 @@ async def save_reports():
|
||||
int(form.get("reports.schedule_day", 6)))
|
||||
await set_setting(db, "reports.schedule_hour",
|
||||
int(form.get("reports.schedule_hour", 8)))
|
||||
await set_setting(db, "reports.schedule_tz", session.get("tz") or "")
|
||||
return redirect(url_for("settings.reports"))
|
||||
|
||||
|
||||
@@ -597,11 +622,7 @@ async def send_report_now():
|
||||
async with current_app.db_sessionmaker() as db:
|
||||
settings = await get_all_settings(db)
|
||||
ok, message = await send_report(current_app._get_current_object())
|
||||
return await render_template(
|
||||
"settings/reports.html",
|
||||
settings=settings,
|
||||
flash={"ok": ok, "message": message},
|
||||
)
|
||||
return await _reports_page(settings, {"ok": ok, "message": message})
|
||||
|
||||
|
||||
def _build_plugin_cfg_from_form(plugin: dict, form) -> dict:
|
||||
@@ -612,9 +633,7 @@ def _build_plugin_cfg_from_form(plugin: dict, form) -> dict:
|
||||
for cfg_key in plugin.get("config", {}).keys():
|
||||
field_name = f"plugin.{name}.{cfg_key}"
|
||||
default_val = plugin["config"][cfg_key]
|
||||
if isinstance(default_val, list):
|
||||
pass # list configs must be set in plugin.yaml
|
||||
elif isinstance(default_val, dict):
|
||||
if isinstance(default_val, dict):
|
||||
sub_dict = {}
|
||||
for sub_key, sub_default in default_val.items():
|
||||
sub_field = f"plugin.{name}.{cfg_key}.{sub_key}"
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
{# settings/_tabs.html — include at top of each settings section.
|
||||
No section <h1>: the breadcrumb kicker ("Settings › …") names the section and
|
||||
the tab strip is the visual header, so we don't stack a redundant title. #}
|
||||
<div style="display:flex;gap:0;border-bottom:1px solid var(--border-mid);margin-bottom:1.5rem;">
|
||||
{% set tabs = [
|
||||
("general", "General", "/settings/general/"),
|
||||
("thresholds", "Thresholds & Retention", "/settings/thresholds/"),
|
||||
("notifications", "Notifications", "/settings/notifications/"),
|
||||
("reports", "Reports", "/settings/reports/"),
|
||||
("auth", "Authentication", "/settings/auth/"),
|
||||
("ansible", "Ansible", "/settings/ansible/"),
|
||||
("plugins", "Plugins", "/settings/plugins/"),
|
||||
] %}
|
||||
{% for key, label, href in tabs %}
|
||||
<a href="{{ href }}"
|
||||
style="padding:0.6rem 1.1rem;font-size:0.875rem;border-bottom:2px solid {{ 'var(--accent)' if active_tab == key else 'transparent' }};color:{{ 'var(--text)' if active_tab == key else 'var(--text-muted)' }};font-weight:{{ '500' if active_tab == key else 'normal' }};text-decoration:none;">
|
||||
{{ label }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{# settings/_tabs.html — the Settings section's pages as one strip of tabs, in
|
||||
each page's section_tabs block above the trail, as Ansible's are (#5377).
|
||||
`active` names the page or the one it sits under. #}
|
||||
{% from "_macros.html" import section_tabs %}
|
||||
{% macro settings_tabs(active) -%}
|
||||
{{ section_tabs([("general", "General", "/settings/general/"),
|
||||
("thresholds", "Thresholds & Retention", "/settings/thresholds/"),
|
||||
("notifications", "Notifications", "/settings/notifications/"),
|
||||
("reports", "Reports", "/settings/reports/"),
|
||||
("auth", "Authentication", "/settings/auth/"),
|
||||
("ansible", "Ansible", "/settings/ansible/"),
|
||||
("plugins", "Plugins", "/settings/plugins/")], active, "Settings") }}
|
||||
{%- endmacro %}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Ansible — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("ansible") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Ansible", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "ansible" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
<div style="max-width:720px;">
|
||||
<div style="display:flex;align-items:baseline;justify-content:space-between;margin-bottom:0.75rem;">
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Auth — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("auth") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Authentication", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "auth" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
<form method="post" action="/settings/auth/">{{ csrf_field() }}
|
||||
<div style="display:grid;gap:1.25rem;max-width:640px;">
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — General — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("general") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("General", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "general" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
<form method="post" action="/settings/general/">{{ csrf_field() }}
|
||||
<div class="card" style="max-width:640px;">
|
||||
@@ -72,7 +72,7 @@
|
||||
<label>Monitor poll interval <span style="color:var(--text-muted);font-size:0.8rem;">(seconds)</span></label>
|
||||
<input type="number" name="monitors.poll_interval_seconds" min="10"
|
||||
value="{{ settings['monitors.poll_interval_seconds'] }}" style="max-width:120px;">
|
||||
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.25rem;">Requires restart to take effect.</div>
|
||||
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.25rem;">How often each monitor is checked, unless it sets its own. Takes effect on the next check.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Notifications — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("notifications") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Notifications", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "notifications" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
<form method="post" action="/settings/notifications/">{{ csrf_field() }}
|
||||
<div style="display:grid;gap:1.25rem;max-width:640px;">
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}{{ plugin.get('name', plugin._dir) }} Settings — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("plugins") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Plugins", "/settings/plugins/"), (plugin.get('name', plugin._dir), "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "plugins" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
<div style="display:flex;align-items:center;gap:1rem;margin-bottom:1.5rem;">
|
||||
<h1 class="page-title" style="margin-bottom:0;">{{ plugin.get('name', plugin._dir) }}</h1>
|
||||
@@ -18,7 +18,7 @@
|
||||
background:color-mix(in srgb,var(--green) 12%,var(--bg));color:var(--green);">Loaded</span>
|
||||
{% elif plugin._enabled %}
|
||||
<span style="font-size:0.75rem;padding:0.15em 0.55em;border-radius:3px;
|
||||
background:var(--bg-elevated);color:var(--text-muted);">Enabled (restart required)</span>
|
||||
background:var(--bg-elevated);color:var(--text-muted);">Enabled, not loaded</span>
|
||||
{% else %}
|
||||
<span style="font-size:0.75rem;padding:0.15em 0.55em;border-radius:3px;
|
||||
background:var(--bg-elevated);color:var(--text-muted);">Disabled</span>
|
||||
@@ -55,7 +55,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div style="font-size:0.8rem;color:var(--text-muted);margin-top:0.4rem;margin-left:1.6rem;">
|
||||
Enable/disable changes take effect after a restart.
|
||||
Enabling loads the plugin straight away. Disabling takes effect after a restart.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -67,16 +67,7 @@
|
||||
|
||||
{% for cfg_key, cfg_default in plugin.config.items() %}
|
||||
|
||||
{% if cfg_default is iterable and cfg_default is not string and cfg_default is not mapping %}
|
||||
<div style="display:flex;align-items:flex-start;gap:0.5rem;padding:0.5rem 0.75rem;
|
||||
background:var(--bg);border-radius:5px;border:1px solid var(--border);
|
||||
font-size:0.82rem;color:var(--text-muted);">
|
||||
<span style="flex-shrink:0;">📋</span>
|
||||
<span><strong style="color:var(--text);">{{ field_label(cfg_key) }}</strong> — list config, edit in
|
||||
<code>plugin.yaml</code> ({{ cfg_default | length }} item{{ 's' if cfg_default | length != 1 }}).</span>
|
||||
</div>
|
||||
|
||||
{% elif cfg_default is mapping %}
|
||||
{% if cfg_default is mapping %}
|
||||
<div style="padding:0.75rem;background:var(--bg);border-radius:5px;border:1px solid var(--border);">
|
||||
<div style="font-size:0.74rem;color:var(--text-muted);text-transform:uppercase;
|
||||
letter-spacing:0.05em;margin-bottom:0.6rem;">{{ field_label(cfg_key) }}</div>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Plugins — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("plugins") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Plugins", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "plugins" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
{# ── Restart banner ────────────────────────────────────────────────────────── #}
|
||||
<div id="restart-banner"></div>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Reports — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("reports") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Reports", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "reports" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
{% if flash %}
|
||||
<div style="padding:0.75rem 1rem;border-radius:6px;margin-bottom:1.25rem;
|
||||
@@ -35,17 +35,17 @@
|
||||
<label>Send on day</label>
|
||||
<select name="reports.schedule_day">
|
||||
{% for i, day in [(0,"Monday"),(1,"Tuesday"),(2,"Wednesday"),(3,"Thursday"),(4,"Friday"),(5,"Saturday"),(6,"Sunday")] %}
|
||||
<option value="{{ i }}" {% if settings['reports.schedule_day'] == i %}selected{% endif %}>
|
||||
<option value="{{ i }}" {% if shown_day == i %}selected{% endif %}>
|
||||
{{ day }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>At hour (UTC)</label>
|
||||
<label>At hour ({{ tz_label() }})</label>
|
||||
<select name="reports.schedule_hour">
|
||||
{% for h in range(24) %}
|
||||
<option value="{{ h }}" {% if settings['reports.schedule_hour'] == h %}selected{% endif %}>
|
||||
<option value="{{ h }}" {% if shown_hour == h %}selected{% endif %}>
|
||||
{{ "%02d:00"|format(h) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
@@ -55,9 +55,7 @@
|
||||
|
||||
<p style="font-size:0.78rem;color:var(--text-muted);margin-top:0.25rem;">
|
||||
Requires SMTP configured in <a href="/settings/notifications/">Notifications</a>.
|
||||
{% if settings['reports.last_sent_at'] %}
|
||||
Last sent: {{ settings['reports.last_sent_at'][:16]|replace("T", " ") }} UTC.
|
||||
{% endif %}
|
||||
{% if last_sent %}Last sent {{ last_sent|when }}.{% endif %}
|
||||
</p>
|
||||
|
||||
<div style="margin-top:1rem;">
|
||||
@@ -70,11 +68,11 @@
|
||||
<div class="card" style="margin-bottom:1.25rem;">
|
||||
<h2 class="section-title" style="margin-bottom:0.75rem;">Report contents</h2>
|
||||
<div style="display:grid;gap:0.35rem;font-size:0.85rem;color:var(--text-muted);">
|
||||
<div>• <strong style="color:var(--text);">Uptime summary</strong> — 7-day % per ping-enabled host</div>
|
||||
<div>• <strong style="color:var(--text);">Hosts currently down</strong> — highlighted at top if any</div>
|
||||
<div>• <strong style="color:var(--text);">Active alerts</strong> — firing, acknowledged, pending rules</div>
|
||||
<div>• <strong style="color:var(--text);">Alert events (7d)</strong> — fired and resolved counts</div>
|
||||
<div>• <strong style="color:var(--text);">Top Traefik routers</strong> — avg req/s over last 24h (if plugin enabled)</div>
|
||||
<div>• <strong style="color:var(--text);">Monitors down now</strong> — named at the top, when any are</div>
|
||||
<div>• <strong style="color:var(--text);">Uptime</strong> — each enabled monitor's share of checks up over 7 days</div>
|
||||
<div>• <strong style="color:var(--text);">Active alerts</strong> — firing, acknowledged and pending rules</div>
|
||||
<div>• <strong style="color:var(--text);">Alert events</strong> — how many fired and resolved over 7 days</div>
|
||||
<div>• <strong style="color:var(--text);">Busiest Traefik routers</strong> — average requests per second over 24 hours, while Traefik is on</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "_macros.html" import crumbs %}
|
||||
{% block title %}Settings — Thresholds & Retention — Steward{% endblock %}
|
||||
{% from "settings/_tabs.html" import settings_tabs %}
|
||||
{% block section_tabs %}{{ settings_tabs("thresholds") }}{% endblock %}
|
||||
{% block breadcrumb %}{{ crumbs([("Settings", "/settings/"), ("Thresholds & retention", "")]) }}{% endblock %}
|
||||
{% block content %}
|
||||
{% set active_tab = "thresholds" %}
|
||||
{% include "settings/_tabs.html" %}
|
||||
|
||||
{% macro pair(label, warn_field, warn_key, crit_field, crit_key, unit, hint, step="1") %}
|
||||
<div class="form-group" style="margin-bottom:1.1rem;">
|
||||
@@ -40,7 +40,7 @@
|
||||
{{ pair("Disk usage", "disk_warn", "thresholds.disk_warn", "disk_crit", "thresholds.disk_crit", "%", "Filesystem usage.") }}
|
||||
{{ pair("Load", "load_warn", "thresholds.load_warn", "load_crit", "thresholds.load_crit", "% per core", "Load average normalized by core count (100% = one full core per core).") }}
|
||||
{{ pair("Temperature", "temp_warn", "thresholds.temp_warn", "temp_crit", "thresholds.temp_crit", "°C", "Hottest reported sensor per host.") }}
|
||||
{{ pair("Ping latency", "latency_warn", "ping.threshold.good_ms", "latency_crit", "ping.threshold.warn_ms", "ms", "Round-trip time. Shared with the Ping widget's good/warn colouring.") }}
|
||||
{{ pair("Response time", "latency_warn", "ping.threshold.good_ms", "latency_crit", "ping.threshold.warn_ms", "ms", "How long a monitor's check takes to answer. Also grades Traefik routers' p95 and the UniFi WAN round trip.") }}
|
||||
{{ pair("Uptime / SLA", "uptime_warn", "thresholds.uptime_warn", "uptime_crit", "thresholds.uptime_crit", "%", "Lower is worse — amber below warn, red below crit.", step="0.1") }}
|
||||
{{ pair("TLS certificate expiry", "tls_warn", "thresholds.tls_warn_days", "tls_crit", "thresholds.tls_crit_days", "days left", "HTTPS monitors whose certificate expires within these many days are flagged. Lower is worse.") }}
|
||||
{{ pair("Clock drift", "clock_warn", "thresholds.clock_warn_s", "clock_crit", "thresholds.clock_crit_s", "seconds", "How far a host's clock may be from Steward's, either way, before its page and the Hosts list call it out.") }}
|
||||
@@ -57,6 +57,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Traefik's router cutoffs, while the plugin runs; its page links here (#5380). #}
|
||||
{% if traefik_on %}
|
||||
<div class="card" id="traefik" style="max-width:640px;margin-top:1.25rem;">
|
||||
<h2 class="section-title" style="margin-bottom:0.5rem;">Traefik routers</h2>
|
||||
<p style="font-size:0.82rem;color:var(--text-muted);margin-bottom:1.25rem;">
|
||||
How much of a router's traffic, over the last 15 minutes, may end in an error before the
|
||||
<a href="/plugins/traefik/">Traefik page</a> and the Routers widget list it.
|
||||
</p>
|
||||
<div class="form-group" style="margin-bottom:1.1rem;">
|
||||
<label for="error_5xx_pct">Server errors (5xx) <span style="color:var(--text-muted);font-size:0.8rem;">(% of responses)</span></label>
|
||||
<input type="number" id="error_5xx_pct" name="error_5xx_pct" min="0" max="100" step="0.01"
|
||||
value="{{ settings['traefik.threshold.error_5xx_pct'] }}" style="max-width:110px;margin-top:0.25rem;">
|
||||
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.3rem;">Above this share, a router is failing (red).</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom:0.25rem;">
|
||||
<label for="error_4xx_pct">Client errors (4xx) <span style="color:var(--text-muted);font-size:0.8rem;">(% of responses)</span></label>
|
||||
<input type="number" id="error_4xx_pct" name="error_4xx_pct" min="0" max="100" step="0.1"
|
||||
value="{{ settings['traefik.threshold.error_4xx_pct'] }}" style="max-width:110px;margin-top:0.25rem;">
|
||||
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.3rem;">Above this share, a router is worth a look (amber): missing routes, failed sign-ins.</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% macro days(label, field, key, hint) %}
|
||||
<div class="form-group" style="margin-bottom:1.1rem;">
|
||||
<label>{{ label }} <span style="color:var(--text-muted);font-size:0.8rem;">(days)</span></label>
|
||||
|
||||
Reference in New Issue
Block a user