Cluster Monitoring in Python with Glances

Anthony Morast
Level Up Coding
Published in
6 min readMay 7, 2021

--

Some years ago my wife bought me a few (6) Raspberry Pi 3 B+ single board computers for Christmas so that I could experiment with creating and managing clusters of computers (it’s what I’d asked for). Since then, I’ve discovered better ways to do high-performance computing with a few higher-end PCs that I use regularly. Thus, my Raspberry Pi cluster largely sits dormant performing only a few small tasks (primarily gathering data for my stock price API and acting as an SSH access point for my home network). Before this, I had used the Raspberry Pis for many tasks and always found myself wondering the same thing, “Are those things still running?” Because of the case I was using I couldn’t physically see the devices to verify the power and processing lights were on or flashing so I really had no indication of their status. Instead of doing rudimentary things like pinging each Pi or attempting to log into each node, I decided to implement a more accessible solution. In this post, I describe the setup and usage of the Glances API and the displaying of certain data on a small LCD screen mounted to the outside of the case I used to store my Pi cluster.

Glances

Glances is a cross-platform monitoring tool written in Python. The API provides a ton of information about what’s going on on the server running the software. What I’ve found most useful is running Glances in web server mode which provides the information via a nifty web interface. Running Glances in this mode listens for connections on port 61208 (by default) and essentially gives information similar to what you’d see via top or htop with a few other niceties. Running Glances in web server mode and navigating to the URL (i.e. http://<server ip>:61208) provides the following output:

This is nice but I had planned on running this software on multiple devices and wanted to be able to determine their availability. Two problems arise, i) having to remember the IP addresses for many devices and ii) having to check (essentially) multiple websites whenever we want to determine device availability.

--

--

I am a professional software engineer and an amateur mathematician. My main interests are programming, machine learning, fluid dynamics, and a few others.