ServerStats is a small server-monitor display project built around:
- a Flask web app that serves live system stats and a layout editor
- a Waveshare e-paper display client that fetches those stats and renders them
The web UI lets you move text around and change text size. The display process reads that saved layout and uses it on the Waveshare screen.
Main files in this project:
server.py: Flask app with/stats,/layout, and the web editorDisplay.py: Waveshare display rendererlayout.json: saved positions and font sizestemplates/index.html: web UIstatic/app.js: web editor logicstatic/styles.css: web editor stylesfonts/: bundled DejaVu fonts used by the display renderer
Clone the repo:
git clone https://github.com/Ryanwires/ServerStats.git
cd ServerStatsInstall Python packages:
pip3 install -r requirements.txtIf you are using Debian or Raspberry Pi OS, also install the DejaVu system fonts so Pillow can render scalable text cleanly:
sudo apt-get update
sudo apt-get install -y fonts-dejavu-coreStart the web server:
cd ~/ServerStats
python3 server.pyOpen the editor in a browser:
http://<server-ip>:5000/
Start the Waveshare display process:
cd ~/ServerStats
python3 Display.pyThe web UI lets you:
- drag text to move it
- type exact
XandYpositions - change text size
- save the layout back into
layout.json
The preview also uses live values from /stats, so it should stay closer to what the real screen is showing.
If you want the web server and display process to start automatically after reboot, use systemd.
Create:
sudo nano /etc/systemd/system/serverstats-web.servicePaste:
[Unit]
Description=ServerStats Web UI
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ryan
WorkingDirectory=/home/ryan/ServerStats
ExecStart=/usr/bin/python3 /home/ryan/ServerStats/server.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetCreate:
sudo nano /etc/systemd/system/serverstats-display.servicePaste:
[Unit]
Description=ServerStats Waveshare Display
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ryan
WorkingDirectory=/home/ryan/ServerStats
ExecStart=/usr/bin/python3 /home/ryan/ServerStats/Display.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetReload systemd, enable both services, and start them:
sudo systemctl daemon-reload
sudo systemctl enable serverstats-web.service
sudo systemctl enable serverstats-display.service
sudo systemctl start serverstats-web.service
sudo systemctl start serverstats-display.servicesystemctl status serverstats-web.service
systemctl status serverstats-display.servicejournalctl -u serverstats-web.service -f
journalctl -u serverstats-display.service -fPull the latest code:
cd ~/ServerStats
git pull
pip3 install -r requirements.txtThen restart the services:
sudo systemctl restart serverstats-web.service
sudo systemctl restart serverstats-display.service- The web server normally runs on port
5000. Display.pycurrently points at:
SERVER = "http://192.168.1.227:5000/stats"
LAYOUT_URL = "http://192.168.1.227:5000/layout"If your server IP changes, update those values in Display.py.
- If text size on the e-paper display does not change, make sure:
- the new
layout.jsonwas saved from the web UI Display.pywas restarted- DejaVu fonts are installed
- the new
Common setup for this project:
server.localrunsserver.py02w.localrunsDisplay.py- The browser opens
http://server.local:5000/ - The display process fetches stats and layout from
server.local