From ce5a0ff9961d1c459d7e7fdd408127ecb1a88271 Mon Sep 17 00:00:00 2001 From: dvirlabs <114520947+dvirlabs@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:41:10 +0300 Subject: [PATCH] Add condition to not add monitoring to uptimekuma if already exsist --- automation/uptime-kuma/sync_kuma.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/automation/uptime-kuma/sync_kuma.py b/automation/uptime-kuma/sync_kuma.py index 3f7a96b..3aec993 100644 --- a/automation/uptime-kuma/sync_kuma.py +++ b/automation/uptime-kuma/sync_kuma.py @@ -35,6 +35,12 @@ def sync_monitor(api, path): print(f"🔄 Syncing monitor: {name}") + # Check if monitor already exists + for monitor in api.get_monitors(): + if monitor["name"] == name: + print(f"⏭️ Monitor '{name}' already exists — skipping") + return + # Get or create tag safely tag_id = None for tag in api.get_tags(): @@ -83,6 +89,7 @@ def sync_monitor(api, path): api.add_monitor_tag(tag_id=tag_id, monitor_id=monitor_id, value="") print(f"✅ Synced monitor '{name}' with tag '{tag_name}'") + def clone_repo(url, dest): print(f"📥 Cloning {url} into {dest}") subprocess.run(["rm", "-rf", dest], check=True)