# MFD Monitor Agent Single-binary host status agent implemented in Go. ## Features - `GET /health` returns process liveness and latest snapshot metadata. - `GET /status` returns the cached full host snapshot. - Periodic background collection keeps HTTP responses fast. - Optional periodic HTTP POST reporting reuses the same `HostStatus` JSON. - Linux collectors read host, network, CPU, memory, disk, process, and TCP listener data from the OS. - Windows and Linux service lifecycle commands are exposed through the CLI. ## Commands ```bash agent run [-config config.json] agent install [-config config.json] [-exe /path/to/agent] agent uninstall [-config config.json] agent start [-config config.json] agent stop [-config config.json] agent version ``` ## Build Linux: ```bash ./scripts/build-linux.sh ``` Windows PowerShell: ```powershell .\scripts\build-windows.ps1 ``` Cross-compile Windows from Linux: ```bash GOOS_TARGET=windows GOARCH_TARGET=amd64 OUTPUT_NAME=agent-windows-amd64.exe ./scripts/build-linux.sh ``` Build outputs are written to `dist/`, which is intentionally ignored by Git. ## Configuration All settings have safe defaults. The HTTP API listens on `127.0.0.1:8080` by default. ```json { "host_id": "host-a", "http": { "listen_address": "127.0.0.1:8080" }, "collect": { "interval": "30s", "timeout": "10s" }, "report": { "enabled": true, "endpoint": "http://center.example.internal/agent/status", "interval": "60s", "timeout": "5s" } } ``` Environment overrides: - `MFD_AGENT_HOST_ID` - `MFD_AGENT_LISTEN` - `MFD_AGENT_COLLECT_INTERVAL` - `MFD_AGENT_COLLECT_TIMEOUT` - `MFD_AGENT_REPORT_ENABLED` - `MFD_AGENT_REPORT_ENDPOINT` - `MFD_AGENT_REPORT_INTERVAL` - `MFD_AGENT_REPORT_TIMEOUT`