Lightweight DIY Linux Server Monitoring Dashboard Using MQTT + Node-RED

Having some Linux servers up and running I checked out 
monitoring tools like Nagios, Zabbix, Cockpit or Prometheus. For small setups, home labs, or lightweight environments, those solutions can feel like using a sledgehammer to crack a nut.

In this post, I’ll show you how to build a lightweight monitoring agent using nothing more than a Bash script, MQTT, and Node-RED. The script collects key metrics from your server — disk usage, memory consumption, CPU load, and available package upgrades — then publishes them to an MQTT broker. From there, Node-RED visualizes the data in a clean, real-time dashboard.

The result? A simple but powerful monitoring system that works across multiple servers, scales with your needs, and gives you instant visibility into the health of your infrastructure. And the best part: you control every piece of it.

Prerequisites

Bash Monitoring Script
Collecting the data
The script is installed in several servers and are publishing the metrics to the broker at the UD. The following metrics are collected with respective command:
  • Disk usage
    • df -h / | awk 'NR==2 {print $5}' | tr -d '%'
  • Memory usage
    • free | grep Mem | awk '{print int(100*$3/$2)}'
  • CPU load last 5 minutes
    • awk '{print $2*100}' /proc/loadavg
  • Upgradable packages
    • apt list --upgradable 2>/dev/null | tail -n +2 | wc -l
  • Timestamp
    • date -Iseconds
One way to publish data to the broker is to do one publish per metric, another way is to publish a complete JSON message with all metrics. In this case the latter is used and you will find the script here.
Checking the script you will see that there are a special handling for the count of upgradable packages. Some Linux distros don't use the "apt" package manager so here the script will set the metric to "false". The other thing is that it will not check for updates more than once a day and instead use the last metric.

Running the script
The easiest way is to simply set up a cronjob with "crontab -e" and add the row with the path to the script "*/5 * * * * bash /home/pi/script/serverCheck.sh". Here the script will run every 5 minutes.
It could also be that you have to make the script executable and put it in a better place.

Node-RED

The flow, found here, is subscribing with topic "servers/+". The switch node is used to distinguish between different reporting servers. So for a second server just add another rule and copy the nodes to the right.
The two function nodes are extracting the data and forwards it to the dashboard nodes.

Conclusion
With just a small Bash script, an MQTT broker, and Node-RED, you now have a lightweight and flexible monitoring system for your Linux servers. It’s simple enough for home labs and Raspberry Pi setups, yet extensible enough to grow with your infrastructure.

The beauty of this approach is that you’re not locked into a heavy monitoring stack. You decide what metrics to collect, how often to publish them, and how they should appear in your dashboard. Want CPU temperature, network stats, or alerting via Telegram or HA app ? Just add them — the framework is already in place.

Whether you’re managing one machine or a handful of servers, this setup gives you clear, real-time visibility at a glance. Give it a try, experiment with new metrics, and make it your own. And if you build something cool on top of this, I’d love to hear about it!

Secret revealed...
This blogg post is the first where I used ChatGPT and Gemini a lot. About 60% of the code and 30 % of the text is generated with help of these tools.

So, if you not have tried it do !!

Bash script MK II
I did an update with 3 servers reporting and added a button which starts a SSH session to respective server. Flow to be found on github.


Comments

Popular posts, last 30 days

iCloud drive sync, or mount, with a Linux, Ubuntu, device

Raspberry Pi OS Lite with GUI, RDP, VNC, Chromium

Home Assistant with VirtualBox or Proxmox or Linux KVM ???

NetworkManager UI and access point, hotspot

Installing Ubuntu 24.04 or 24.10/25.04 on an old MacBook Air(2011)

Raspberry Pi 2, 3, 4, 5 USB SSD or USB drive boot

Waveshare CAN hat with Signal K & OpenPlotter

IVT, Bosch heat pump easy integration, Home Assistant

Clone the Raspberry boot disk

Signal K charts, offline & online