Add uptime-kuma alert template

This commit is contained in:
Julian-Samuel Gebühr 2022-09-18 10:38:06 +02:00
parent e12938b695
commit be2800b3f9
1 changed files with 11 additions and 1 deletions

View File

@ -84,7 +84,17 @@ def get_alert_messages(alert_data: dict, raw_mode=False) -> list:
def uptime_kuma_alert_to_markdown(alert_data: dict):
return ["**Uptime Kuma Alert Data:**\n```\n" + str(alert_data).strip("\n").strip() + "\n```"]
tags_readable = ", ".join([tag["name"] for tag in alert_data["monitor"]["tags"]])
message = (
f"""**Firing 🔥**: Monitor down: {alert_data["monitor"]["url"]}
* **Error:** {alert_data["heartbeat"]["msg"]}
* **Started at:** {alert_data["heartbeat"]["time"]}
* **Tags:** {tags_readable}
* **Source:** "Uptime Kuma"
"""
)
return [message]
def uptime_kuma_resolved_to_markdown(alert_data: dict):