Add alert tools, mutes, short status, and backup summary
This commit is contained in:
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user