A four line system monitor
Whilst doing a bit of idle web surfing I stumbled across this little gizmo and thought that it would provide me with a few hours of amusement so I went ahead and ordered one. After it arrived it sat on my desk for a few days while we shot off to Omeo for a bit of a break for a few days.
When we got back I installed it and started playing. Fortunately Adafruit have a sample python script which I was able to massage to come up with this.
As you can see it displays the date, time, CPU temp and memory and CPU usage.
I’ve already got USB booting happening so it boots from a 1TB Seagate USB 3.0 SSD which is just two partitions – “/boot” and “/”. That works well too.
The python script
This was, or is, my first ever python script. I’m adept at Perl, COBOL, Fortran, etc. so I was able to work out a simple script with only minimal messing around. It’s a good thing that Adafruit have some detailed instructions which include a python script to get it working. A bit of modifying / rewriting the Adafruit script and I had it displaying what I wanted.
So, without further ado here’s here’s the Python3 script which I was going to embed here but WordPress is wilfully destroying the indentation. A quick look will reveal that there is no error handling whatsoever. I haven’t learnt how to do that yet so that’ll be introduced on another day. There’s also almost no commenting either.
Well now that I’ve got this working and working well I thought that I’d get one of these which has buttons and is a bigger. The little one that I have now will go onto my other P1 4 (1GB) which is used for storage and as a test bed for this site. It’s also booting from USB and is also running Pi OS 64bit which seems to me to be nice and stable.
The bigger display will allow more lines of text but I don’t know what I’ll put there yet. It also has a couple of buttons and a joystick. I can use the buttons for things like “sudo reboot” or “sudo poweroff” or something.
Stand by for future developments.