t-261012090606: порог load-алертов по умолчанию 0.75*nproc (16 ядер → 12.0), policy cpu_alert_threshold переопределяет; фикс 230 ложных алертов/час

This commit is contained in:
Simbiot Harness 2026-10-12 09:09:52 +00:00
parent e6f09ac08a
commit ebaa677c69

View file

@ -740,8 +740,13 @@ def _reflex_tick(level_cfg, seq: int, model: dict):
period = datetime.fromtimestamp(seq * level_cfg.every, tz=timezone.utc)
payload = {"level": "sec", "seq": seq, "load1": load,
"ts": period.isoformat()}
# алерт-порог из policy (по умолчанию 8 — как simbiotd)
thr = (model.get("policy") or {}).get("cpu_alert_threshold", 8)
# алерт-порог: по умолчанию 0.75*nproc (16 ядер → 12; t-261012090606),
# policy cpu_alert_threshold переопределяет при наличии
try:
_default_thr = max(8.0, 0.75 * os.cpu_count())
except Exception:
_default_thr = 12.0
thr = (model.get("policy") or {}).get("cpu_alert_threshold", _default_thr)
if load is not None and load >= thr:
payload["alert"] = f"load {load:.2f} >= {thr}"
# без-LLM команды: отвечаем на входящие-команды без ответа