display tag fro alterts, cleanup udp
This commit is contained in:
@@ -26,41 +26,3 @@ async def cleanup_connections(hbdclass):
|
||||
if hasattr(conn, 'cancel_overdue_timer'):
|
||||
conn.cancel_overdue_timer()
|
||||
|
||||
|
||||
async def start(
|
||||
config: dict,
|
||||
hbdclass: callable,
|
||||
pushmsg=None,
|
||||
msg_to_websockets=None,
|
||||
):
|
||||
"""Start monitor background tasks.
|
||||
|
||||
Note: Reachability monitoring is now timer-based and happens in udp.py
|
||||
when HTB messages arrive. This function can be used for additional
|
||||
monitoring tasks.
|
||||
|
||||
Currently runs a simple status logger every 5 minutes.
|
||||
"""
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger_interval = 300 # Log status every 5 minutes
|
||||
|
||||
while True:
|
||||
await asyncio.sleep(logger_interval)
|
||||
|
||||
# Log monitoring status
|
||||
total_hosts = len(hbdclass.Host.hosts)
|
||||
up_count = sum(
|
||||
1 for h in hbdclass.Host.hosts.values()
|
||||
for c in h.connections.values()
|
||||
if c.state == hbdclass.Connection.UP
|
||||
)
|
||||
overdue_count = sum(
|
||||
1 for h in hbdclass.Host.hosts.values()
|
||||
for c in h.connections.values()
|
||||
if c.state == hbdclass.Connection.OVERDUE
|
||||
)
|
||||
|
||||
logger.debug(
|
||||
f"Monitor status: {total_hosts} hosts, {up_count} UP, {overdue_count} OVERDUE"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user