Ollama Watchdog 是一个基于 Vue 3 和 Go 语言开发的项目,主要用于监控和管理 GPU 资源。
项目前端使用 Vue 3 和 ECharts 进行数据可视化,后端使用 Go 语言进行数据处理和监控。
sudo curl -sSL https://raw.githubusercontent.com/LanceLRQ/ollama-watchdog/main/install.sh | sh
sudo wget -qO- https://raw.githubusercontent.com/LanceLRQ/ollama-watchdog/main/install.sh | sh
-
克隆项目到本地:
git clone https://github.com/LanceLRQ/ollama-watchdog.git cd ollama-watchdog/web
-
安装依赖:
npm install
-
启动开发服务器:
npm run dev
-
构建生产环境代码:
npm run build
-
进入后端目录:
cd src
-
运行 Go 服务:
go run -tags dev . # 或者 sh ./dev.sh
-
编译二进制:
sh ./build.sh
go >= 1.23
项目默认配置文件位于:~/.config/ollama-watchdog/server.yaml
配置文件采用 YAML 格式,支持动态修改(通过 ollama-watchdog config set
命令)。
- 类型:
string
- 默认值:
"0.0.0.0:23333"
- 说明: 看门狗主服务监听地址(IP + 端口)。
- 配置命令:
ollama-watchdog config set listen "0.0.0.0:23333"
- 类型:
string[]
(数组) - 默认值:
["http://127.0.0.1:11434"]
- 说明: 多 Ollama 服务地址(负载均衡或集群场景),用逗号分隔多个地址。
- 配置命令:
ollama-watchdog config set ollama_listens "http://127.0.0.1:11434,http://127.0.0.1:11435"
- 类型:
string[]
(数组) - 默认值:
["ollama"]
- 说明: 需要监控的 Ollama 服务名称(用于进程管理),用逗号分隔。注意顺序需要和ollama_listens的一致,才能保证能够正确的在监控页面上重启ollama。
- 配置命令:
ollama-watchdog config set ollama_services "ollama-gpu0,ollama-gpu-1"
- 类型:
string
- 默认值:
"/usr/bin/nvidia-smi"
- 说明:
nvidia-smi
可执行文件路径(用于 GPU 监控)。 - 配置命令:
ollama-watchdog config set nvidia_smi_path "/usr/bin/nvidia-smi"
- 类型:
string
- 默认值:
"~/.config/ollama-watchdog/.gpu_samples"
- 说明: GPU 采样数据存储路径(SQLite 数据库)。
- 配置命令:
ollama-watchdog config set gpu_sample_db "~/.config/ollama-watchdog/.gpu_samples"
- 数组类型:配置时用英文逗号分隔值(如
"a,b,c"
)。 - 动态生效:配置完成后需要执行
systemctl restart ollama-watchdog
以使配置生效。 - 默认值:未显式配置时使用结构体中的默认值。
欢迎提交 Issue 和 Pull Request 来帮助改进项目。
本项目采用 MIT 许可证。