From 7478f092f5e9e13361affd5cf47dabca331464c4 Mon Sep 17 00:00:00 2001 From: xxm Date: Mon, 10 Aug 2026 18:32:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mofin=5Fhealth=20LLM=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=8E=A8=E9=80=81=EF=BC=88=E8=A7=84=E8=8C=83?= =?UTF-8?q?5.5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/mofin_health.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/deploy/profile-scripts/mofin_health.py b/deploy/profile-scripts/mofin_health.py index d463102d..bd2141f5 100644 --- a/deploy/profile-scripts/mofin_health.py +++ b/deploy/profile-scripts/mofin_health.py @@ -1048,6 +1048,20 @@ def build_report(): # 若LLM故障,功能树根节点标 fail if not llm_health["ok"]: feature_tree["status"] = "fail" + # 失败告警(2026-08-10新增):LLM故障推XMPP,不只标红 + try: + import sys as _sys + if '/home/hmo/.hermes/profiles/position-analyst/scripts' not in _sys.path: + _sys.path.insert(0, '/home/hmo/.hermes/profiles/position-analyst/scripts') + from alert_helper import notify, WARNING + _first = llm_health["errors_recent"][0] if llm_health["errors_recent"] else {} + notify("LLM端点故障", + f"最近{llm_health['scan_window_min']}分钟{llm_health['error_count']}次调用失败" + f"({_first.get('log','?')} {_first.get('time','?')}: {_first.get('msg','')[:80]})。" + f"gateway进程可能正常但LLM服务不可用,请检查opencode.ai端点。", + WARNING) + except Exception as _ae: + print(f"[LLM_MON] 告警发送失败: {_ae}", file=sys.stderr) feature_tree.setdefault("warn_detail", {})["llm"] = ( f"LLM端点最近{llm_health['scan_window_min']}分钟{llm_health['error_count']}次错误" f"({llm_health['errors_recent'][0]['log'] if llm_health['errors_recent'] else '?'})")