2025-10-12 20:29:08 +02:00
2025-10-12 20:29:08 +02:00
2025-10-12 18:03:32 +02:00
2025-10-12 19:57:05 +02:00
2025-10-12 20:29:08 +02:00
2025-10-12 14:53:27 +02:00

CM Dashboard

CM Dashboard is a Rust-powered terminal UI for real-time monitoring of CMTEC infrastructure hosts. It subscribes to the CMTEC ZMQ gossip network where lightweight agents publish SMART, service, and backup metrics, and presents them in an efficient, keyboard-driven interface built with ratatui.

┌─────────────────────────────────────────────────────────────────────┐
│ CM Dashboard • cmbox                                                 │
├─────────────────────────────────────────────────────────────────────┤
│ Storage • ok:1 warn:0 crit:0       │ Services • ok:1 warn:0 fail:0   │
│ ┌─────────────────────────────────┐ │ ┌─────────────────────────────── │ │
│ │Drive    Temp  Wear Spare Hours │ │ │Service memory: 7.1/23899.7 MiB│ │
│ │nvme0n1  28°C  1%   100%  14489 │ │ │Disk usage: —                  │ │
│ │         Capacity Usage          │ │ │  Service  Memory     Disk      │ │
│ │         954G     77G (8%)       │ │ │✔ sshd     7.1 MiB   —          │ │
│ └─────────────────────────────────┘ │ └─────────────────────────────── │ │
├─────────────────────────────────────────────────────────────────────┤
│ CPU / Memory • warn                 │ Backups                         │
│ System memory: 5251.7/23899.7 MiB  │ Host cmbox awaiting backup      │ │
│ CPU load (1/5/15): 2.18 2.66 2.56  │ metrics                         │ │
│ CPU freq: 1100.1 MHz               │                                 │ │
│ CPU temp: 47.0°C                    │                                 │ │
├─────────────────────────────────────────────────────────────────────┤
│ Alerts • ok:0 warn:3 fail:0        │ Status • ZMQ connected          │
│ cmbox: warning: CPU load 2.18      │ Monitoring • hosts: 3           │ │
│ srv01: pending: awaiting metrics    │ Data source: ZMQ  connected    │ │
│ labbox: pending: awaiting metrics   │ Active host: cmbox (1/3)        │ │
└─────────────────────────────────────────────────────────────────────┘
Keys: [←→] hosts [r]efresh [q]uit

Requirements

  • Rust toolchain 1.75+ (install via rustup)
  • Network access to the CMTEC metrics gossip agents (default tcp://<host>:6130; install zeromq/libzmq on the host)
  • Configuration files under config/ describing hosts and dashboard preferences

Installation

Clone the repository and build with Cargo:

git clone https://github.com/cmtec/cm-dashboard.git
cd cm-dashboard
cargo build --release

The optimized binary is available at target/release/cm-dashboard. To install into your Cargo bin directory:

cargo install --path dashboard

Configuration

On first launch, the dashboard will create config/dashboard.toml and config/hosts.toml automatically if they do not exist.

You can also generate starter configuration files manually with the built-in helper:

cargo run -p cm-dashboard -- init-config
# or, once installed
cm-dashboard init-config --dir ./config --force

This produces config/dashboard.toml and config/hosts.toml. The primary dashboard config looks like:

[hosts]
default_host = "srv01"

[[hosts.hosts]]
name = "srv01"
enabled = true

[[hosts.hosts]]
name = "labbox"
enabled = true

[dashboard]
tick_rate_ms = 250
history_duration_minutes = 60

[[dashboard.widgets]]
id = "nvme"
enabled = true

[[dashboard.widgets]]
id = "alerts"
enabled = true

[data_source]
kind = "zmq"

[data_source.zmq]
endpoints = ["tcp://127.0.0.1:6130"]

Adjust the host list and data_source.zmq.endpoints to match your CMTEC gossip network. If you prefer to manage hosts separately, edit the generated hosts.toml file.

Features

  • Real-time monitoring with ZMQ gossip network architecture
  • Storage health with drive capacity, usage, temperature, and wear tracking
  • Per-service resource tracking including memory and disk usage by service
  • CPU/Memory monitoring with load averages, temperature, and GPU metrics
  • Alert system with color-coded highlighting and threshold-based warnings
  • Multi-host support with seamless host switching (, , h, l, Tab)
  • Backup status monitoring with restic integration
  • Keyboard-driven interface with help overlay (?)
  • Configuration management via TOML files for hosts and dashboard settings

Getting Started

cargo run -p cm-dashboard -- --config config/dashboard.toml
# specify a single host
cargo run -p cm-dashboard -- --host srv01
# override ZMQ endpoints at runtime
cargo run -p cm-dashboard -- --zmq-endpoint tcp://srv01:6130,tcp://labbox:6130
# increase logging verbosity
cargo run -p cm-dashboard -- -v

Keyboard Shortcuts

Key Action
/ h Previous host
/ l / Tab Next host
? Toggle help overlay
r Update status message
q / Esc Quit

Agent

The metrics agent runs on each host and publishes SMART, service, and backup data to the ZMQ gossip network. The agent auto-detects system configuration and requires root privileges for hardware monitoring.

# Run agent with auto-detection
sudo cargo run -p cm-dashboard-agent

# Run with specific configuration
sudo cargo run -p cm-dashboard-agent -- --config config/agent.toml

# Manual configuration
sudo cargo run -p cm-dashboard-agent -- \
    --hostname srv01 \
    --bind tcp://*:6130 \
    --smart-devices nvme0n1,sda \
    --services nginx,postgres

The agent automatically:

  • Detects available storage devices for SMART monitoring
  • Discovers running systemd services for resource tracking
  • Configures appropriate collection intervals per host type
  • Requires root access for smartctl and system metrics

Use --disable-smart, --disable-service, or --disable-backup to skip specific collectors.

Development

  • Format: cargo fmt
  • Check workspace: cargo check
  • Build release binaries: cargo build --release

The dashboard subscribes to the CMTEC ZMQ gossip network (default tcp://127.0.0.1:6130). Received metrics are cached per host and retained in an in-memory ring buffer for future trend analysis.

Description
Linux TUI dashboard for host health overview
Readme 13 MiB
2025-12-09 11:56:40 +01:00
Languages
Rust 100%