diff --git a/plugins/host_agent/routes.py b/plugins/host_agent/routes.py index 848c05a..644dbee 100644 --- a/plugins/host_agent/routes.py +++ b/plugins/host_agent/routes.py @@ -465,8 +465,16 @@ async def widget_history(): # hundreds–thousands of points — a noisy, unreadable line. Bucket-average to a # readable point count, keeping the shape. series = {k: _downsample(v) for k, v in series.items()} + + # Stable y-axis ceiling. All three series are percentages, so snap the top up + # to the next 10% band (floor 20, cap 100). Auto-scaling to the exact peak made + # the chart "zoom" jump on every poll as the peak drifted a few %; snapping to + # a band keeps the axis steady across refreshes while still filling the panel. + peak = max((p[1] for s in series.values() for p in s), default=0.0) + y_max = min(100, max(20, ((int(peak) // 10) + 1) * 10)) return await render_template( "widget_history.html", host=host, series=series, hours=hours, wid=wid, + y_max=y_max, ) diff --git a/plugins/host_agent/templates/widget_history.html b/plugins/host_agent/templates/widget_history.html index 1414ad5..1bd73a8 100644 --- a/plugins/host_agent/templates/widget_history.html +++ b/plugins/host_agent/templates/widget_history.html @@ -11,8 +11,19 @@ No agent metrics for {{ host.name }} in the last {{ hours }}h yet. {% else %} -
- +
+ {# Name the host the graph represents — the panel title is generic. #} +
+ {% if session.user_id %} + {{ host.name }} + {% else %} + {{ host.name }} + {% endif %} + · last {{ hours }}h +
+
+ +