network monitoring

This commit is contained in:
Alex Tau 2025-06-07 15:59:05 +03:00
parent 8af7b683b6
commit 8b18d407d7
21 changed files with 434 additions and 53 deletions

View file

@ -18,8 +18,12 @@ async def get_client() -> TelegramClient:
def format_message(alert: Alert, note: str) -> str:
severity_emoji = SEVERITY_TO_EMOJI[alert.severity]
note_formatted = f" - <i>{note}</i>" if note else ""
message = f"{severity_emoji} {alert.alert_type} Alert{note_formatted}\n{alert.message}"
note_formatted = f"{note}, " if note else ""
if "ongoing" in note_formatted:
note_formatted += f"since {alert.created.isoformat()}"
else:
note_formatted += f"at {alert.created.isoformat()}"
message = f"{severity_emoji} {alert.alert_type} Alert - <i>{note_formatted}</i>\n{alert.message}"
return message