diff --git a/hbd/server/udp.py b/hbd/server/udp.py index 4cc359e..2616666 100644 --- a/hbd/server/udp.py +++ b/hbd/server/udp.py @@ -477,11 +477,23 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict): notify_mod.Notification(title=f"[INFO] {uname}", body=f"{host.name} booted", level="INFO"), )) if message: - eventlog(uname, "INFO", "msg: %s" % message, service=service) + eventlog(uname, "INFO", message, service=service) if conn.getstate() != hbdcls.Connection.UP: lasts = conn.state d = conn.newstate(hbdcls.Connection.UP, now) + # On reboot, pre-boot plugin data and derived alerts are stale. + # Cancel all plugin timers and wipe plugin state so timers restart + # cleanly from the first two post-boot samples. + for pname in list(host.plugin_timers): + host.cancel_plugin_timer(pname) + host.plugin_data.clear() + stale_plugin_keys = [ + k for k in host.alert_states + if k not in ("rtt",) and not k.startswith("connectivity.") + ] + for k in stale_plugin_keys: + del host.alert_states[k] # Clear connectivity alert now that the host is back up _set_connectivity_alert(host, conn.afam, "OK") # Don't log/notify RECOVER for a brand-new host seen for the first time —