Your 'Systant. A system daemon on Linux that communicates via MQTT to get diagnostic info from, and send commands to, a Linux computer.
Written in Elixir because fuck you, and written mostly by Claude because fuck everything.
- Add comprehensive command configuration to systant.toml with user-defined commands
- Create Systant.CommandExecutor module with strict security validation:
* Whitelist-only command execution (no arbitrary shell commands)
* Parameter validation against allowed lists
* Command timeouts and confirmation requirements
* Full audit logging and response tracking
- Implement Systant.MqttHandler for processing command messages:
* JSON command parsing and validation
* Response publishing to systant/{hostname}/responses topic
* Built-in "list" command to show available commands
* Error handling with detailed response messages
- Update MqttClient to use custom handler instead of Logger
- Security features:
* Only predefined commands from TOML config
* Parameter substitution with validation ($SERVICE, $PATH, etc.)
* Execution timeouts and comprehensive logging
* Structured response format with request tracking
Example commands configured: restart services, system info, disk usage, process status, network tests.
Users can customize commands in their systant.toml file.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| dashboard | ||
| nix | ||
| server | ||
| .envrc | ||
| .gitignore | ||
| CLAUDE.md | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
Systant
A comprehensive Elixir-based system monitoring solution with real-time dashboard, designed for deployment across multiple NixOS hosts.
Components
- Server (
server/): Elixir OTP application that collects and publishes system metrics via MQTT - Dashboard (
dashboard/): Phoenix LiveView web dashboard for real-time monitoring - Nix Integration: Complete NixOS module and packaging for easy deployment
Features
System Metrics Collection
- CPU: Load averages (1/5/15min) and utilization monitoring
- Memory: System memory usage and swap monitoring
- Disk: Usage statistics and capacity monitoring for all drives
- System Alarms: Real-time alerts for disk space, memory pressure, etc.
- System Info: Uptime, Erlang/OTP versions, scheduler information
Real-time Dashboard
- Phoenix LiveView interface showing all connected hosts
- Live system metrics and alert monitoring
- Automatic reconnection and error handling
MQTT Integration
- Publishes comprehensive system metrics every 30 seconds
- Uses hostname-based topics:
systant/${hostname}/stats - Structured JSON payloads with full system data
- Configurable MQTT broker connection
Quick Start
Development Environment
# Enter Nix development shell
nix develop
# Run the server
cd server && mix run --no-halt
# Run the dashboard (separate terminal)
just dashboard
# or: cd dashboard && mix phx.server
Production Deployment (NixOS)
# Build and install via Nix
nix build
sudo nixos-rebuild switch --flake .
# Or use the NixOS module in your configuration:
# imports = [ ./path/to/systant/nix/nixos-module.nix ];
# services.systant.enable = true;
Configuration
Default MQTT configuration (customizable via environment variables):
- Host:
mqtt.home:1883 - Topics:
systant/${hostname}/statsandsystant/${hostname}/commands - Interval: 30 seconds
- Client ID:
systant_${random}(auto-generated to avoid conflicts)
Architecture
- Server:
server/lib/systant/mqtt_client.ex- MQTT publishing and command handling - Metrics:
server/lib/systant/system_metrics.ex- System data collection using:os_mon - Dashboard:
dashboard/lib/dashboard/mqtt_subscriber.ex- Real-time MQTT data consumption - Nix:
nix/package.nixandnix/nixos-module.nix- Complete packaging and deployment
Roadmap
- ✅ Phase 1: System metrics collection with real-time dashboard
- 🔄 Phase 2: Command system for remote host management
- 🔄 Phase 3: Home Assistant integration for automation
See CLAUDE.md for detailed development context and implementation notes.