Add Home Assistant MQTT auto-discovery integration
- Implement `Systant.HaDiscovery` module for automatic device registration - Add comprehensive sensor discovery: CPU, memory, GPU, disk, network, temperature - Update MQTT client to publish discovery messages on startup - Add HomeAssistant configuration section to systant.toml - Create example configuration file with localhost MQTT broker - Update CLAUDE.md with complete HA integration documentation - Add mosquitto to development dependencies for testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
# Systant Configuration Example
|
||||
# Copy to systant.toml and customize for your environment
|
||||
|
||||
[general]
|
||||
enabled_modules = ["cpu", "memory", "disk", "gpu", "network", "temperature", "processes", "system"]
|
||||
collection_interval = 30000 # milliseconds
|
||||
startup_delay = 5000 # milliseconds
|
||||
|
||||
[mqtt]
|
||||
host = "localhost" # MQTT broker hostname/IP
|
||||
port = 1883 # MQTT broker port
|
||||
client_id_prefix = "systant" # Prefix for MQTT client ID
|
||||
username = "" # MQTT username (optional)
|
||||
password = "" # MQTT password (optional)
|
||||
qos = 0 # MQTT QoS level
|
||||
|
||||
# Home Assistant MQTT Discovery Configuration
|
||||
[homeassistant]
|
||||
discovery_enabled = true # Enable/disable HA auto-discovery
|
||||
discovery_prefix = "homeassistant" # HA discovery topic prefix
|
||||
|
||||
[cpu]
|
||||
enabled = true
|
||||
|
||||
[memory]
|
||||
enabled = true
|
||||
show_detailed = true
|
||||
|
||||
[disk]
|
||||
enabled = true
|
||||
include_mounts = [] # Only include these mounts (empty = all)
|
||||
exclude_mounts = ["/snap", "/boot", "/dev", "/sys", "/proc", "/run", "/tmp"]
|
||||
exclude_types = ["tmpfs", "devtmpfs", "squashfs", "overlay"]
|
||||
min_usage_percent = 1 # Minimum usage to report
|
||||
|
||||
[gpu]
|
||||
enabled = true
|
||||
nvidia_enabled = true
|
||||
amd_enabled = true
|
||||
max_gpus = 8
|
||||
|
||||
[network]
|
||||
enabled = true
|
||||
include_interfaces = [] # Only include these interfaces (empty = all)
|
||||
exclude_interfaces = ["lo", "docker0", "br-", "veth", "virbr"]
|
||||
min_bytes_threshold = 1024 # Minimum traffic to report
|
||||
|
||||
[temperature]
|
||||
enabled = true
|
||||
cpu_temp_enabled = true
|
||||
sensors_enabled = true
|
||||
temp_unit = "celsius"
|
||||
|
||||
[processes]
|
||||
enabled = true
|
||||
max_processes = 10
|
||||
sort_by = "cpu" # "cpu" or "memory"
|
||||
min_cpu_percent = 0.0
|
||||
min_memory_percent = 0.0
|
||||
max_command_length = 50
|
||||
|
||||
[system]
|
||||
enabled = true
|
||||
include_uptime = true
|
||||
include_load_average = true
|
||||
include_kernel_version = true
|
||||
include_os_info = true
|
||||
|
||||
[commands]
|
||||
enabled = true
|
||||
timeout_seconds = 30
|
||||
log_executions = true
|
||||
|
||||
# Example commands - customize for your needs
|
||||
[[commands.available]]
|
||||
trigger = "restart"
|
||||
command = "systemctl"
|
||||
allowed_params = ["nginx", "apache2", "docker", "ssh"]
|
||||
description = "Restart system services"
|
||||
|
||||
[[commands.available]]
|
||||
trigger = "info"
|
||||
command = "uname"
|
||||
allowed_params = ["-a"]
|
||||
description = "Show system information"
|
||||
|
||||
[[commands.available]]
|
||||
trigger = "df"
|
||||
command = "df"
|
||||
allowed_params = ["-h", "/", "/home", "/var", "/tmp"]
|
||||
description = "Show disk usage"
|
||||
|
||||
[[commands.available]]
|
||||
trigger = "ps"
|
||||
command = "ps"
|
||||
allowed_params = ["aux", "--sort=-pcpu", "--sort=-pmem"]
|
||||
description = "Show running processes"
|
||||
|
||||
[[commands.available]]
|
||||
trigger = "ping"
|
||||
command = "ping"
|
||||
allowed_params = ["-c", "4", "8.8.8.8", "google.com", "1.1.1.1"]
|
||||
description = "Network connectivity test"
|
||||
|
||||
[logging]
|
||||
level = "info" # debug, info, warn, error
|
||||
log_config_changes = true
|
||||
log_metric_collection = false
|
||||
Reference in New Issue
Block a user