An UNRAID system monitoring screen script, powered by Python, matplotlib, and psutil. Designed to run completely in Docker, but can also be run elsewhere. Probably using matplotlib in ways it wasn't designed for, lmao.
Based on scripts from Adafruit and going overboard with the concept.
This is a personal project that was meant for my personal NAS built inside a CyberPower UPS.
The screen (an ILI9341) is driven by an FT232H board with all the processing done fully with Python living inside a Docker container.
The project has undergone significant changes that have not been tracked via git
but the end-goal has been making the main script highly fault-tolerant and passably performant under the constraints of a high-level language interacting with low-level hardware.
Note
This project additionally is the author's first foray into Python programming; prior to this project I did not have any Python experience whatsoever. With that in mind, there is potentially unrealized optimizations that can be done, but alas, as this project stands, it should work good enough.
- Fully Python based
- Monitors the following:
- Overall CPU load
- CPU temp (automatically finds correct temp sensor)
- CPU load per core (plots as a heatmap)
- Current CPU frequency (not graphed)
- System-wide disk activity
- Network activity
- NIC status (will warn if it goes down)
- Memory usage
- Array usage
- Small footprint: uses less than 1% CPU on most systems and runs at low-priority
- Adapts to your hardware speed and current CPU load
- Useful verbose logging and stats (user-selectable)
- "Run and done" approach
- Run the
init.sh
file and it does the rest for you: setup, dependency updates, and more
- Run the
- Fault-tolerant with clear log output on what went wrong
- Includes numerous fallbacks for incorrect settings
- Designed to run fully inside a Docker container but can also be run outside of an UNRAID context as well
- Looks neat imho 👍
Assuming you actually want to physically replicate this yourself, wire up the components as follows:
ILI9341 | FT232 |
---|---|
VCC | 5V |
GND | GND |
CS | C0 |
RESET | C2 |
DC | C1 |
MOSI | D1 |
SLK | D0 |
LED | 3V |
MISO | D2 |
- UNRAID
- Using the official Python Docker
--- or ---
- Python 3.7 or newer
- A working internet connection
- Your preferred flavor of Linux (only tested in Debian so far)
- Requires
apt
as the package manager - Requires
sudo
permissions (as we are interfacing directly with hardware)
- Requires
Important
At a minimum, the init.sh
, main.py
, and settings.yaml
files should be in the same working directory.
Tip
The script expects there to be a background.bmp
or an equivalent 240 x 320
resolution image as a splash image placed in the working directory. This image is shown when first loading and left on the screen once the script is terminated until power is disconnected. The splash image is optional but is recommended.
The Docker configuration file needed is in the docker-config
folder.
As for how to use this, idk (instructions to come at a later time).
Assuming you have the Docker image sorted out using the config file:
Make a folder in appdata
and place the needed files in it. With the WebGUI, edit the Docker. Under the Script Source
option, point it to /mnt/user/appdata/[yourfolderhere]
.
If the Docker is configured correctly, it will execute the init.sh
script and should start monitoring your system.
Check the Docker log for script output.
If running outside of UNRAID (eg. a Raspberry Pi):
git clone https://github.com/WeegeeNumbuh1/UNRAID_status-screen
sudo UNRAID_status-screen/init-portable.sh
The script will create its own virtual Python environment and do what is needed to run.
For Windows users:
No support. Likely will not run.
UNRAID-screen.py
will work, but assumes you're using VSCode + Juptyer. Also YMMV. You've been warned.
The settings.yaml
file has comments built-in that explain all the user-adjustable options that can be configured. Refer to that file for details.
Note
The script has fallbacks for environment settings like CPU_TEMP_SENSOR
and NETWORK_INTERFACE
in case they can't be found, and will list out all available sensors when this happens so that you can correct it in the settings.yaml
file for next time.
Refer to Changelog.txt
.
- Figure out blitting with
matplotlib
for significant plot generation speedup - Figure out how to make the screen rendering routine work faster
- Use multiple cores? Use a GPU library? Who knows... (might never happen)