feat: record RTT history per heartbeat for charting

Capture RTT on every heartbeat using the existing plugin_data history
mechanism, recording under rtt_ipv4 or rtt_ipv6 keys. Maintains 100-sample
retention per host and address family.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEimzMv4Q5EjFg3hoiZ69T
This commit is contained in:
2026-08-17 07:18:01 -04:00
co-authored by Claude Sonnet 5
parent a7b698e6b9
commit 52968201fa
2 changed files with 69 additions and 0 deletions
+5
View File
@@ -482,6 +482,7 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
print("conndata failed: %s" % e)
return
if res:
eventlog(uname, "WARNING", res)
if host.watched:
@@ -562,6 +563,10 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
if interval > 0:
host.interval = interval
# Record RTT history for charting
if rtt is not None:
host.add_plugin_data(f"rtt_{conn.afam.lower()}", {"rtt": rtt}, timestamp=now)
# Timer-based reachability monitoring
# Reset overdue timer on every heartbeat
if interval > 0 and conn.getstate() != hbdcls.Connection.DOWN: