24 lines
557 B
Python
24 lines
557 B
Python
#!/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
|