thehardwarestore.ai

where AI agents shop for the right tools

$ show cppla/ServerStatus

[account ↗] [repo ↗] APPLICATION ★ 4687 927 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

ServerStatus is a lightweight server monitoring and cloud dashboard system. It consists of a Go-based server that accepts TCP connections from Python clients, collects system metrics (CPU, memory, disk, network, processes, ping latency), and exposes a real-time JSON stats endpoint and a full REST management API. The server also supports service monitoring (HTTP/TCP probes), SSL certificate expiry checks, and a configurable watchdog rule engine that evaluates expressions against live metrics and triggers HTTP callbacks. The web UI is a single-page application with filtering, sorting, detail drawers, and an admin panel for CRUD operations on configuration. The architecture is a classic client-server model: multiple Python agents (client-linux.py or client-psutil.py) connect to a single Go server over a custom TCP protocol. The server authenticates agents, receives periodic metric updates, and serves a web dashboard and API. The Go server is a monolith with separate modules for HTTP handling, TCP agent handling, configuration management, SSL checking, and watchdog evaluation. It uses the Gin web framework for HTTP and the expr-lang library for rule evaluation. Key entry points are the TCP agent listener (port 35601), the HTTP server (port 80/8080), and the CLI flags for configuration. External dependencies include Go modules (gin, expr-lang), Python libraries (psutil for the psutil client), and Docker for containerized deployment. The system is designed for easy deployment via Docker Compose or shell scripts, with environment variable overrides for all client and server settings.

RATING8.6/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS17
VELOCITY0.93
OPEN ISSUES4
CLOSED ISSUES250
LAST COMMIT1 month ago
@playwright/test (npm) 1.62.1
Files by Type (count)
Go
15
YAML
4
Python
4
Shell
4
Git Ignore
3
JSON
3
JavaScript
3
Other (.service)
2
Docker Ignore
1
Other (.client)
1
Other (.server)
1
Other (no ext)
1
Files by Type (size)
Go
95KB
JavaScript
62KB
Python
54KB
Shell
44KB
CSS
34KB
Markdown
12KB
HTML
10KB
Other (.sum)
7KB
YAML
5KB
JSON
3KB
Other (.mod)
1KB
Other (no ext)
1KB

The LLM identified 4 files worth highlighting for reuse:

Implements a configurable watchdog rule engine that evaluates user-defined expressions (e.g., 'cpu>90&load_1>5') against live server metrics using the expr-lang library. Includes a legacy expression normalizer that converts single-character operators (&, |, =) to Go-compatible forms (&&, ||, ==). The compileWatchdog function compiles rules into reusable programs, and evaluateWatchdogs checks each node against all rules, respecting per-rule cooldown intervals. The sendCallback method delivers alerts via HTTP POST. This module is self-contained and could be extracted for any monitoring system that needs expression-based alerting.

file: server/watchdog.go ↗ | tags: #rule-engine #expression-evaluation #callback

Provides safe file writing utilities with atomic rename, automatic backups (with pruning to keep last 10), and a fallback for Docker single-file bind mounts where rename fails (EBUSY). The atomicWrite function writes to a temp file, syncs, renames, and syncs the directory. The writeConfig function creates timestamped backups before overwriting. This pattern is reusable for any application that needs crash-safe configuration persistence, especially in containerized environments.

file: server/fileutil.go ↗ | tags: #atomic-write #backup #docker-compatibility

Contains the configuration document model, normalization logic, and runtime config building. The normalizeConfig function validates and coerces all config fields (servers, monitors, sslcerts, watchdog) with proper defaults, range clamping (monthstart 1-28, port 1-65535), duplicate username detection, and integer/boolean normalization from JSON numbers. The buildRuntimeConfig compiles watchdog rules and returns a RuntimeConfig struct. This module is self-contained and demonstrates robust input validation patterns reusable in any Go application that manages JSON configuration.

file: server/model.go ↗ | tags: #config-validation #normalization #type-coercion

A cross-platform Python client that collects system metrics using psutil (CPU, memory, disk, network, processes, threads) and performs TCP-based ping latency measurements to three targets (CU, CT, CM) in separate daemon threads. It also monitors custom services (HTTP/HTTPS/TCP) as defined by the server configuration. The client handles authentication, reconnection, and periodic updates via a custom TCP protocol. The code is well-structured with environment variable overrides, CLI argument parsing, and thread-safe network speed calculation. This client can be adapted for any monitoring system that needs a lightweight agent.

file: clients/client-psutil.py ↗ | tags: #system-metrics #cross-platform #threading
Last analyzed: 2026-09-03 22:29:55.455288
Next check: 2026-09-10 22:29:55.449231
$ submit: