xiaowei-system/daemon/solutions.json

58 lines
1.9 KiB
JSON

{
"version": 2,
"solutions": [
{
"id": "sol-0001",
"pattern": "磁盘使用率 > 85%,清理系统缓存",
"detect": {"metric": "disk_pct", "op": "gt", "value": 85},
"actions": [
{"type": "shell", "cmd": "sudo apt-get autoremove -y 2>/dev/null; pip cache purge 2>/dev/null; npm cache clean --force 2>/dev/null", "verify": "disk_pct < 85", "timeout": 60}
],
"frequency": 0,
"last_applied": null,
"success_count": 0,
"fail_count": 0,
"learned_from": "prebuilt"
},
{
"id": "sol-0002",
"pattern": "zhiyid 进程挂了,自动重启",
"detect": {"metric": "processes", "op": "dead", "value": "zhiyid"},
"actions": [
{"type": "shell", "cmd": "systemctl --user restart zhiyid.service", "verify": null, "timeout": 10}
],
"frequency": 0,
"last_applied": null,
"success_count": 0,
"fail_count": 0,
"learned_from": "prebuilt"
},
{
"id": "sol-0003",
"pattern": "NewAPI 进程挂了,自动重启",
"detect": {"metric": "processes", "op": "dead", "value": "newapi"},
"actions": [
{"type": "shell", "cmd": "systemctl --user restart new-api.service 2>/dev/null || (nohup new-api > /dev/null 2>&1 &)", "verify": null, "timeout": 10}
],
"frequency": 0,
"last_applied": null,
"success_count": 0,
"fail_count": 0,
"learned_from": "prebuilt"
},
{
"id": "sol-0004",
"pattern": "内存使用率 > 90%,重启最耗内存的服务",
"detect": {"metric": "mem_pct", "op": "gt", "value": 90},
"actions": [
{"type": "shell", "cmd": "systemctl --user restart bge-embed.service", "verify": "mem_pct < 85", "timeout": 30}
],
"frequency": 0,
"last_applied": null,
"success_count": 0,
"fail_count": 0,
"learned_from": "prebuilt"
}
]
}