diff --git a/alertbot.py b/alertbot.py index c7478f1..76a049d 100644 --- a/alertbot.py +++ b/alertbot.py @@ -50,7 +50,7 @@ def get_alert_type(data): if data['status'] == "firing": return "prometheus-alert" else: - return "grafana-resolved" + return "prometheus-resolved" except KeyError: pass @@ -78,6 +78,8 @@ def get_alert_messages(alert_data: dict, raw_mode=False) -> list: messages = grafana_alert_to_markdown(alert_data) elif alert_type == "prometheus-alert": messages = prometheus_alert_to_markdown(alert_data) + elif alert_type == "prometheus-resolved": + messages = prometheus_alert_to_markdown(alert_data) elif alert_type == "uptime-kuma-alert": messages = uptime_kuma_alert_to_markdown(alert_data) elif alert_type == "uptime-kuma-resolved": @@ -162,12 +164,11 @@ def prometheus_alert_to_markdown(alert_data: dict) -> str: messages = [] for alert in alert_data["alerts"]: message = ( - f"""**{alert['status']}**: {alert['annotations']['description']} - + f"""**{alert['status']}** {'💚' if alert['status'] == 'resolved' else '🔥'}: {alert['annotations']['description']} * **Alertname:** {alert["labels"]['alertname']} * **Instance:** {alert["labels"]['instance']} * **Job:** {alert["labels"]['job']} - """ +""" ) messages.append(message) return messages diff --git a/maubot.yaml b/maubot.yaml index d4dd2d4..66f4be2 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,8 +1,8 @@ maubot: 0.1.0 id: de.hyteck.alertbot -version: 1.1.1 +version: 1.1.2 license: AGPL-3.0-or-later modules: - alertbot main_class: AlertBot -webapp: true \ No newline at end of file +webapp: true