From c47576637f2de7f917be20ea6c4698bcb9c60609 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Thu, 14 May 2026 14:54:53 -0400 Subject: [PATCH] feat: suppress alerts for unwatched hosts Hosts with watch: false in config no longer appear in the Alerts page or nav bar alert counts. Events still appear in the Log of Events. Hosts without a config entry default to watch: false. Co-Authored-By: Claude Sonnet 4.6 --- hbd/server/hbdclass.py | 2 +- hbd/server/http.py | 4 ++++ hbd/server/udp.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hbd/server/hbdclass.py b/hbd/server/hbdclass.py index 4b97a49..d4d22b0 100644 --- a/hbd/server/hbdclass.py +++ b/hbd/server/hbdclass.py @@ -286,7 +286,7 @@ class Host: Host.hosts[name] = self self.num = num self.dyn = False - self.watched = True + self.watched = False self.upcount = 0 self.interval = 0 self.doesack = -1 diff --git a/hbd/server/http.py b/hbd/server/http.py index 7c33fa2..bb8017d 100644 --- a/hbd/server/http.py +++ b/hbd/server/http.py @@ -325,6 +325,8 @@ async def start( from .threshold import AlertLevel critical = warning = ok = 0 for host in hbdclass.Host.hosts.values(): + if not host.watched: + continue if not _can_operate_host(user, host): continue levels = {s.level for s in host.alert_states.values()} @@ -595,6 +597,8 @@ async def start( all_alerts = [] for hostname, host in hbdclass.Host.hosts.items(): + if not host.watched: + continue if not _can_view_host(user, host): continue if threshold_checker: diff --git a/hbd/server/udp.py b/hbd/server/udp.py index 726477b..6470bb2 100644 --- a/hbd/server/udp.py +++ b/hbd/server/udp.py @@ -333,6 +333,8 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict): # Use new config function to check dyndns dyndnshosts = config_mod.get_dyndnshosts(cfg) host.dyn = uname in dyndnshosts + watchhosts = config_mod.get_watchhosts(cfg) + host.watched = uname in watchhosts # Apply user-access settings from config access = config_mod.get_host_access(cfg, uname) host.apply_access(access["owner"], access["managers"], access["monitors"])