Add uptime-kuma resolved

This commit is contained in:
Julian-Samuel Gebühr 2022-12-14 17:15:30 +01:00
parent 7addc34fa3
commit 0852881a79
2 changed files with 14 additions and 2 deletions

View File

@ -102,7 +102,19 @@ def uptime_kuma_alert_to_markdown(alert_data: dict):
def uptime_kuma_resolved_to_markdown(alert_data: dict):
return ["**Uptime Kuma Resolved Data:**\n```\n" + str(alert_data).strip("\n").strip() + "\n```"]
tags_readable = ", ".join([tag["name"] for tag in alert_data["monitor"]["tags"]])
message = (
f"""**Resolved 💚**: {alert_data["monitor"]["url"]}
* **Status:** {alert_data["heartbeat"]["msg"]}
* **Started at:** {alert_data["heartbeat"]["time"]}
* Duration until resolved {alert_data["heartbeat"]["duration"]}
* **Tags:** {tags_readable}
* **Source:** "Uptime Kuma"
"""
)
return [message]
def grafana_alert_to_markdown(alert_data: dict) -> list:

View File

@ -1,6 +1,6 @@
maubot: 0.1.0
id: de.hyteck.alertbot
version: 1.0.0
version: 1.1.0
license: AGPL-3.0-or-later
modules:
- alertbot