Add condition to not add monitoring to uptimekuma if already exsist
This commit is contained in:
parent
2dee628753
commit
ce5a0ff996
@ -35,6 +35,12 @@ def sync_monitor(api, path):
|
|||||||
|
|
||||||
print(f"🔄 Syncing monitor: {name}")
|
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
|
# Get or create tag safely
|
||||||
tag_id = None
|
tag_id = None
|
||||||
for tag in api.get_tags():
|
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="")
|
api.add_monitor_tag(tag_id=tag_id, monitor_id=monitor_id, value="")
|
||||||
print(f"✅ Synced monitor '{name}' with tag '{tag_name}'")
|
print(f"✅ Synced monitor '{name}' with tag '{tag_name}'")
|
||||||
|
|
||||||
|
|
||||||
def clone_repo(url, dest):
|
def clone_repo(url, dest):
|
||||||
print(f"📥 Cloning {url} into {dest}")
|
print(f"📥 Cloning {url} into {dest}")
|
||||||
subprocess.run(["rm", "-rf", dest], check=True)
|
subprocess.run(["rm", "-rf", dest], check=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user