- Updated all module names from SystemStatsDaemon to Systant - Renamed application config from :system_stats_daemon to :systant - Updated service files and documentation - Release binary now at _build/prod/rel/systant/bin/systant 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.2 KiB
Markdown
61 lines
1.2 KiB
Markdown
# Systant
|
|
|
|
An Elixir application that runs as a systemd daemon to:
|
|
1. Publish system stats to MQTT every 30 seconds
|
|
2. Listen for commands over MQTT and log them to syslog
|
|
|
|
## Configuration
|
|
|
|
Edit `config/config.exs` to configure MQTT connection:
|
|
|
|
```elixir
|
|
config :systant, Systant.MqttClient,
|
|
host: "localhost",
|
|
port: 1883,
|
|
client_id: "systant",
|
|
username: nil,
|
|
password: nil,
|
|
stats_topic: "system/stats",
|
|
command_topic: "system/commands",
|
|
publish_interval: 30_000
|
|
```
|
|
|
|
## Building
|
|
|
|
```bash
|
|
mix deps.get
|
|
mix compile
|
|
```
|
|
|
|
## Running
|
|
|
|
```bash
|
|
# Development
|
|
mix run --no-halt
|
|
|
|
# Production release
|
|
MIX_ENV=prod mix release
|
|
_build/prod/rel/systant/bin/systant start
|
|
```
|
|
|
|
## Systemd Installation
|
|
|
|
1. Build production release
|
|
2. Copy binary to `/usr/local/bin/`
|
|
3. Copy `systant.service` to `/etc/systemd/system/`
|
|
4. Enable and start:
|
|
|
|
```bash
|
|
sudo systemctl enable systant
|
|
sudo systemctl start systant
|
|
```
|
|
|
|
## Features
|
|
|
|
- Publishes "Hello from systant" stats every 30 seconds to `system/stats` topic
|
|
- Listens on `system/commands` topic and logs received messages
|
|
- Configurable MQTT connection settings
|
|
- Runs as systemd daemon with auto-restart
|
|
- Logs to system journal
|
|
|