Skip to content

Commit

Permalink
Add uptime-kuma resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
moan0s committed Dec 14, 2022
1 parent 7addc34 commit 0852881
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion alertbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion maubot.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0852881

Please sign in to comment.