From 45a3731cbcc5169dbb73266828796f56407ff547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Pe=C5=A1ek?= Date: Thu, 5 Nov 2026 17:51:34 +0100 Subject: [PATCH] fleet-beacon: merge WAN telemetry files from /dev/shm/fleet_wan_*.json --- fleet-beacon | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fleet-beacon b/fleet-beacon index b0a4583..d0a95ca 100755 --- a/fleet-beacon +++ b/fleet-beacon @@ -156,9 +156,26 @@ def main(): except Exception: data = {} data[hostname] = payload + + # Merge any WAN telemetry files (< 30s old) + try: + import glob + for wpath in glob.glob("/dev/shm/fleet_wan_*.json"): + if time.time() - os.path.getmtime(wpath) < 30: + with open(wpath, "r") as wf: + wpayload = json.load(wf) + if isinstance(wpayload, dict) and "name" in wpayload: + data[wpayload["name"]] = wpayload + except Exception: + pass + tmp_path = f"{shm_fleet}.tmp.{os.getpid()}" with open(tmp_path, "w") as f: json.dump(data, f) + try: + os.chmod(tmp_path, 0o666) + except Exception: + pass os.replace(tmp_path, shm_fleet) except Exception: pass