SystemMetricsPanel is a self-contained Bash module for low-overhead observation of host-level performance indicators over Bash shell.
Originally implemented as a single-line “monitoring bar,” the system has evolved into a multi-line framed dashboard, providing a clearer and more expressive representation of system state while maintaining minimal resource consumption.
It exposes two complementary execution modes:
- Realtime mode, which refreshes an in-place textual panel at a fixed cadence, and
- Snapshot mode, which emits a single multi-line report suitable for logging or embedding into other tools.
The script relies exclusively on standard GNU/Linux interfaces such as /proc, /sys, and df, ensuring maximum portability and zero external dependencies.
The script is designed around the following objectives:
- Portability – Runs on any common Linux distribution using only POSIX tools.
- Low overhead – Sampling incurs negligible system load.
- SSH compatibility – Designed for terminal-based remote sessions.
- Self-configuration – Automatically detects a suitable network interface.
- Clear separation of logic – Data gathering and presentation layers remain distinct.
Each refresh cycle performs the following steps:
- Determine the network interface
- Sample system metrics
- CPU load
- Memory usage
- Network throughput
- Disk utilization
- Host metadata
- Normalize and compute meaningful statistics
- Render the panel
- Multi-line Unicode frame
- Colors via ANSI sequences
- CPU mini-bar (text-based)
- Mode behavior
- Realtime: refresh in-place
- Snapshot: print once and exit
Two /proc/stat samples are taken one second apart:
- Compute total and idle times
CPU% = (1 - Δidle / Δtotal) * 100- Rendered as:
CPU : 23% [####------]
Derived from /proc/meminfo:
MemTotal - MemAvailable- Converted to GiB
- Example:
MEM : 3.12 GB / 7.80 GB
Reads /sys/class/net/<iface>/statistics/*_bytes:
- Computes deltas over the interval
- Converts bytes → Mbps
- Example:
NET : ↑2.44 Mb/s | ↓0.97 Mb/s
Uses df -hP, extracts % for / and /boot/efi:
DISK : /: 42%, /boot/efi: 12%
Single printed panel → exit.
Updates continuously:
- Recomputes metrics
- Moves cursor up
- Redraws entire panel
- Quit with
q
chmod +x SystemMetricsPanel.sh
# Default (snapshot)
./SystemMetricsPanel.sh
# Realtime (if script prompts for mode)
./SystemMetricsPanel.sh
# Specify interface
./SystemMetricsPanel.sh eth0┌────────────────────────────────────────────────────────────────────────────┐
│ SYSTEM METRICS PANEL (LIVE) │
├────────────────────────────────────────────────────────────────────────────┤
│HOST : srv-node01 │
│USER : admin │
│UP : 152 h │
│CPU : 17% [###-------] │
│MEM : 2.91 GB / 7.80 GB │
│NET : ↑3.12 Mb/s | ↓1.02 Mb/s │
│DISK : /: 42%, /boot/efi: 12% │
│Press q to quit │
└────────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────────────┐
│ SYSTEM METRICS SNAPSHOT │
├────────────────────────────────────────────────────────────────────────────┤
│HOST : srv-node01 │
│USER : admin │
│UPTIME : 152 h │
├────────────────────────────────────────────────────────────────────────────┤
│CPU LOAD : 23% [####------] │
│MEMORY : 3.12 GB / 7.80 GB │
│NETWORK : ↑2.44 Mb/s | ↓0.97 Mb/s │
│DISK : /: 42%, /boot/efi: 12% │
└────────────────────────────────────────────────────────────────────────────┘
Possible future enhancements:
- Per-core CPU view
- Historical plot storage
- Temperature sensors
- JSON/CSV export
Provided “as-is,” without warranty.
You may freely adapt or extend the script.