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.
Go to file
ryan b8e7c48ecf Implement network throughput monitoring instead of cumulative bytes
- Add iftop as runtime dependency in package.nix and flake.nix
- Modify SystemMetrics to calculate network throughput (bytes/second)
- Track previous network stats in MQTT client state for throughput calculation
- Update Home Assistant discovery to show RX/TX throughput sensors
- Replace cumulative byte counters with real-time throughput metrics
- Add proper throughput calculation with time-based differentials

This provides much more useful real-time network monitoring compared
to ever-increasing cumulative byte counts.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 21:02:29 -07:00
.vscode Set elixirLS dir to server/ 2025-08-08 19:06:26 -07:00
dashboard Enhanced dashboard with comprehensive metrics display 2025-08-05 21:06:50 -07:00
nix Implement network throughput monitoring instead of cumulative bytes 2025-08-08 21:02:29 -07:00
server Implement network throughput monitoring instead of cumulative bytes 2025-08-08 21:02:29 -07:00
.envrc Fix flake.nix by removing non-existent pytest-homeassistant-custom-component package 2025-08-02 21:08:44 -07:00
.gitignore Add Home Assistant development environment to flake 2025-08-02 21:00:07 -07:00
CLAUDE.md Add Home Assistant MQTT auto-discovery integration 2025-08-08 20:38:34 -07:00
flake.lock Clean up Nix configuration and remove old files 2025-08-02 19:41:40 -07:00
flake.nix Implement network throughput monitoring instead of cumulative bytes 2025-08-08 21:02:29 -07:00
justfile Obviously you should have pushed these, claude 2025-08-05 23:02:52 -07:00
Procfile Obviously you should have pushed these, claude 2025-08-05 23:02:52 -07:00
README.md Obviously you should have pushed these, claude 2025-08-05 23:02:52 -07:00

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 both server and dashboard together (recommended)
just dev

# Or run components individually
just server      # Start systant server
just dashboard   # Start Phoenix LiveView dashboard

# Other development commands
just deps        # Install dependencies for both projects
just compile     # Compile both projects  
just test        # Run tests for both projects
just clean       # Clean both projects

Hivemind Process Management

The project uses Hivemind for managing multiple processes during development:

  • Server runs on MQTT publishing system metrics every 30 seconds
  • Dashboard runs on http://localhost:4000 with real-time LiveView interface
  • Color-coded logs for easy debugging (server=green, dashboard=yellow)

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}/stats and systant/${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.nix and nix/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.