Quiet Sentinel:讓伺服器安靜地監察自身
Quiet Sentinel: let the server watch itself, quietly
Quiet Sentinel 是一個伺服器監察控制面板,每 30 秒收集 CPU、RAM 和磁碟使用量,為各項指標建立基線並列出異常警示。它透過 Ollama 使用開放權重 Qwen 2.5 14B Instruct,為警示生成簡短解釋和一項核查步驟;模型沒有 Shell 權限,也不能更改伺服器。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady.
What I Built
Quiet Sentinel is a small control panel for a server I would rather not babysit. It collects CPU, RAM and disk usage every 30 seconds, learns a separate baseline for each measurement, and brings unusual changes into a scrollable alert feed. My server is called GafCloud.
When an anomaly is worth showing, an open-weight Qwen model adds a short explanation and one verification step. The model does not get a shell or permission to change the server. It explains; I decide what to do.
Demo
The screenshot shows the actual GafCloud dashboard. CPU, RAM and disk cards are real readings. The 97% CPU alert is deliberately synthetic and labeled DEMO; its explanation was generated by Qwen 2.5 14B Instruct through Ollama on my Mac.
The app stays private on localhost rather than exposing an unauthenticated monitoring API publicly. You can reproduce the demo from the README: start the dashboard with Ollama enabled, start the Linux collector, and press Test alert. The demo uses a separate host so it does not replace the real CPU card.
Code
Source code, setup instructions, tests and service samples
How I Built It
The dashboard and detector use Python's standard library. Each host/metric pair has its own rolling history. A median and median absolute deviation provide a baseline that tolerates outliers better than an average alone. Repeated alerts for the same series are suppressed for 15 minutes.
The first live run caught a useful mistake: normal CPU fluctuations near idle looked anomalous against a narrow baseline. I added a 15-percentage-point CPU deviation guard, while leaving RAM and disk detection alone. That is a practical heuristic, not a universal solution to monitoring noise.
Ollama runs the open-weight Qwen 2.5 14B Instruct model. In the verified setup, the model runs on my Mac and the monitoring app runs on GafCloud, connected through a private SSH tunnel. No model download is needed on GafCloud. The Mac must remain awake and the tunnel must remain open for AI explanations. Statistical monitoring continues if inference fails.
I also added an optional OpenAI provider so users can bring an existing API key. That is an alternative, not the open-weight demonstration for this entry. Its deployment test returned an exhausted-credit error; I am not claiming successful OpenAI inference.
Eight automated tests cover baseline behavior, independent series, CPU noise filtering, repeat suppression, provider parsing, and AI failures. AI coding assistance was used to build and refine this project.
Why Does Open Innovation Matter?
The model is a replaceable part of a small, readable monitoring tool. With Ollama and Qwen, alert interpretation can run on hardware I control without sending those measurements to a hosted inference company. The tested split setup still needs the private network connection between my server and Mac; it is not a claim that GafCloud is self-contained.
Keeping the statistical detector separate from the model makes the system understandable. I can inspect why an alert fired and change the model without handing over incident detection or system access to it. The open-weight path is implemented and demonstrated.
The Lazy Payoff
The server takes its own readings and collects alerts in one small panel. I do not have to keep checking three separate system tools, and duplicate anomalies are suppressed. I tested it on my own server this week; I have not measured hours saved or incident-response improvements.
This is a prototype: restarting loses history, there is no authentication or push delivery, and AI explanations can be wrong. It is a deliberately small tool for watching my own machine, with those limits stated up front.
來源:DEV Community · dev.to
