Lightweight web dashboard for monitoring FreeBSD mpr and mps (Broadcom/LSI SAS HBA) driver DMA chain frame utilization.
Designed for production storage servers where chain frame exhaustion can cause I/O stalls and system freezes.
For each detected mpr or mps controller (up to 6 per driver):
| Metric | Description |
|---|---|
chain_free |
Chain frames available right now |
chain_free_lowwater |
Lowest chain_free has reached since boot |
chain_alloc_fail |
Failed chain frame allocations since boot (should be 0) |
io_cmds_active |
I/O commands in flight right now |
io_cmds_highwater |
Peak concurrent I/O commands since boot |
The dashboard shows per-controller tabs with colour-coded health indicators, stat cards, and time-series charts for chain frame utilization, I/O activity, and allocation failures.
Three components, no external dependencies beyond Python 3.11:
- Data collector — shell script daemon sampling
sysctlvalues every 60 seconds to per-controller CSV files in/var/log/mpr_monitor/ - HTTP server — minimal Python HTTP server on port 8080 serving the dashboard and CSV data
- Dashboard — single-file HTML page using Chart.js (loaded from CDN) with auto-detection of controllers and 30-second auto-reload
- FreeBSD (tested on 14.x)
- Python 3 (
pkg install python3) - One or more Broadcom/LSI SAS HBA controllers using the
mprormpsdriver - Network access to port 8080 (internal/firewalled networks — no authentication)
Clone the repository and run the install script as root:
git clone https://github.com/YOURUSERNAME/mpr-monitor.git
cd mpr-monitor
sh install.shOr as a one-liner (replace YOURUSERNAME with your GitHub username):
fetch -o - https://github.com/YOURUSERNAME/mpr-monitor/archive/refs/heads/main.tar.gz | tar xzf - && cd mpr-monitor-main && sh install.shThe installer will:
- Verify Python 3.11 is available
- Verify at least one
mprormpscontroller exists - Install application files to
/usr/local/share/mpr_monitor/ - Install rc.d service scripts to
/usr/local/etc/rc.d/ - Enable and start both services
- Report the dashboard URL
Access the dashboard at http://<server-ip>:8080.
cd mpr-monitor
sh install.sh uninstallThis will:
- Stop both services
- Remove
rc.confentries - Remove rc.d scripts
- Remove application files
- Remove log files
- Optionally remove collected data (you will be prompted)
The system is fully reverted as if mpr-monitor was never installed.
Installed files:
/usr/local/share/mpr_monitor/
index.html Dashboard web page
mpr_monitor_httpd.py Python HTTP server
mpr_collect.sh Data collection script
/usr/local/etc/rc.d/
mpr_monitor rc.d service: HTTP server
mpr_collect rc.d service: data collector
/var/log/mpr_monitor/
mpr0_stats.csv CSV data for mpr controller 0
mps0_stats.csv CSV data for mps controller 0
... (one file per detected controller)
/var/log/
mpr_monitor.log HTTP server log
mpr_collect.log Data collector log
# Check status
service mpr_collect status
service mpr_monitor status
# Restart
service mpr_monitor restart
# Stop
service mpr_collect stop
service mpr_monitor stopThe mpr and mps drivers use DMA chain frames to map scatter/gather lists for I/O operations. Under heavy load (many drives, concurrent ZFS operations, Samba clients), the default allocation of 16384 chain frames can be exhausted. When this happens, the driver cannot submit new I/O, which stalls the system.
The fix is to increase hw.mpr.max_chains (or hw.mps.max_chains) in /boot/loader.conf, but you need visibility into actual utilization to choose the right value. This tool provides that visibility.
Key loader.conf tunables:
hw.mpr.max_chains=65536
hw.mps.max_chains=65536
This requires a reboot to take effect. Use this dashboard to monitor chain frame consumption under real workload and determine the appropriate value before and after the change.
MIT