feat(host_agent): NFS delay per mount, read from /proc/self/mountstats (#5996)
CI / lint (push) Successful in 2s
CI / unit (push) Failing after 1m32s
CI / integration (push) Successful in 1m31s
CI / publish (push) Skipped

Each sample carries each NFS mount's requests since the last one: how many
a second, their round trip and execute time (READ and WRITE on their own),
and how many were sent again or hit a major timeout. mountstats is the
kernel's own count and never touches the share, so it reads while one is
stuck. Steward stores them per mount and the slowest on the host as
nfs_exe_max_ms, for an "NFS slow" rule and the host page's NFS chart beside
mounts_stalled; each mount's bar says what a request took.

Agent 1.22.0 (which also carries the backlog order from 41fc807).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 09:46:14 -04:00
co-authored by Claude Opus 5.5
parent 2df8431de9
commit 3f9aae7f46
12 changed files with 282 additions and 13 deletions
@@ -95,3 +95,22 @@ async def test_sensors_not_counted_are_listed_once_per_reason(app):
page = " ".join(page.split())
assert (f"Not counted, likely nothing wired to them: temp3 62°C ({falls}); "
f"SYSTIN 115°C, AUXTIN0 110°C ({held}).") in page
async def test_an_nfs_mount_says_what_a_request_took_and_a_local_one_says_nothing(app):
"""#5996: the delay under each NFS mount's bar, graded at 100 and 1000 ms."""
async with app.test_request_context("/plugins/host_agent/h1/metrics"):
page = await render_plugin_template(
app, "host_agent", "_host_metrics.html", host=SimpleNamespace(address="10.0.0.2"), stale=False,
reg=SimpleNamespace(distro=None, kernel=None, arch=None, agent_version=None,
last_seen_at=datetime.now(timezone.utc)),
hostlvl={}, cores=[], nets={}, disks_io={}, temps={},
mounts={"/nfs/data": {"disk_used_pct": 40.0, "nfs_ops_per_sec": 4.0, "nfs_exe_ms": 250.0,
"nfs_retrans": 3.0},
"/nfs/media": {"disk_used_pct": 30.0, "nfs_ops_per_sec": 0.0},
"/": {"disk_used_pct": 20.0}})
page = re.sub(r">\s+<", "><", " ".join(page.split()))
assert '<span class="tone-warn">250.0 ms a request</span> · 4/s · <span class="tone-warn">3 sent again</span>' in page
assert "NFS idle" in page and page.count("NFS ") == 2
assert "timed out" not in page
assert not hex_colours(page), hex_colours(page)