This commit is contained in:
2025-04-06 11:38:10 +02:00
commit b7ba40b4da
7 changed files with 234 additions and 0 deletions

23
api/kuma.py Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
from uptime_kuma_api import UptimeKumaApi
import json
class KumaAPI:
def __init__(self, ip, password):
self.api = UptimeKumaApi(ip)
self.api.login('admin', password)
def get_status(self):
monitors = self.api.get_monitors()
res = {}
for monitor in monitors:
id = monitor['id']
status = self.api.get_monitor_status(id)
res[id] = {
"status": status,
"name": monitor["name"],
}
return res