Allow critical-only load alerts
This commit is contained in:
@@ -11,6 +11,7 @@ async def monitor_resources(cfg, notify, bot, chat_id):
|
||||
interval = int(alerts_cfg.get("interval_sec", 60))
|
||||
cooldown = int(alerts_cfg.get("cooldown_sec", 900))
|
||||
notify_recovery = bool(alerts_cfg.get("notify_recovery", True))
|
||||
load_only_critical = bool(alerts_cfg.get("load_only_critical", False))
|
||||
|
||||
disk_warn = int(cfg.get("thresholds", {}).get("disk_warn", 80))
|
||||
snapshot_warn = int(cfg.get("disk_report", {}).get("threshold", disk_warn))
|
||||
@@ -57,9 +58,11 @@ async def monitor_resources(cfg, notify, bot, chat_id):
|
||||
level = 1
|
||||
else:
|
||||
level = 0
|
||||
if load_only_critical and level == 1:
|
||||
level = 0
|
||||
|
||||
if level == 0:
|
||||
if state["load_level"] > 0 and notify_recovery:
|
||||
if state["load_level"] > 0 and notify_recovery and not load_only_critical:
|
||||
await notify(bot, chat_id, f"🟢 Load OK: {load:.2f}", level="info", key="load_ok")
|
||||
state["load_level"] = 0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user