diff --git a/pythonkuma/models.py b/pythonkuma/models.py index 52753dc..d6ae91c 100644 --- a/pythonkuma/models.py +++ b/pythonkuma/models.py @@ -84,6 +84,13 @@ class UptimeKumaMonitor(UptimeKumaBaseModel): monitor_url: str | None = field( metadata={"deserialize": lambda v: None if v == "null" else v} ) + monitor_uptime_ratio_1d: float | None = None + monitor_uptime_ratio_30d: float | None = None + monitor_uptime_ratio_365d: float | None = None + + monitor_response_time_seconds_1d: float | None = None + monitor_response_time_seconds_30d: float | None = None + monitor_response_time_seconds_365d: float | None = None @dataclass diff --git a/pythonkuma/uptimekuma.py b/pythonkuma/uptimekuma.py index 4048a69..d83ee70 100644 --- a/pythonkuma/uptimekuma.py +++ b/pythonkuma/uptimekuma.py @@ -102,10 +102,14 @@ async def metrics(self) -> dict[str | int, UptimeKumaMonitor]: else sample.labels["monitor_name"] ) - monitors.setdefault(key, sample.labels).update( - {sample.name: sample.value} + name = ( + f"{sample.name}_{window}" + if (window := sample.labels.get("window")) + else sample.name ) + monitors.setdefault(key, sample.labels).update({name: sample.value}) + return { key: UptimeKumaMonitor.from_dict(value) for key, value in monitors.items()