Add alert tools, mutes, short status, and backup summary

This commit is contained in:
2026-02-08 22:43:16 +03:00
parent ae2d085214
commit 972c8eb6a7
12 changed files with 280 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import time
from datetime import datetime
from aiogram import Bot
from app import cfg
from services.alert_mute import is_muted
from services.incidents import log_incident
@@ -37,8 +38,17 @@ def _in_quiet_hours(alerts_cfg: dict) -> bool:
return now_min >= start_min or now_min < end_min
async def notify(bot: Bot, chat_id: int, text: str, level: str = "info", key: str | None = None):
async def notify(
bot: Bot,
chat_id: int,
text: str,
level: str = "info",
key: str | None = None,
category: str | None = None,
):
alerts_cfg = cfg.get("alerts", {})
if category and is_muted(category):
return
if _in_quiet_hours(alerts_cfg):
allow_critical = bool(alerts_cfg.get("quiet_hours", {}).get("allow_critical", True))
if not (allow_critical and level == "critical"):