While setting up my BPQ node, I came across another node that hosted an interesting application: System Info. This application displayed stats such as CPU usage, system uptime, available memory, etc. I think this would be interesting for remote management, so I decided to implement it.
I found this guide, which was very helpful, but it used the Perl language. Not a big fan of Perl (mostly because I don’t know it well), I wanted to rewrite the small script in Python. Here is the script. Before you run it, you’ll need to install the following modules:
I’ve included a requirements.txt file, so all you’ll have to do is run
pip install -r requirements.txt. If you haven’t got pip install, run
sudo apt install -y python3-pip.
Follow the guide linked to above, until you get to the scripting portion. Simply replace the line in
/etc/inetd.conf with this:
bpqdemo stream tcp nowait YOURUSER /usr/local/linbpq/sysinfo.py
make sure you change the path to wherever your linbpq installation is located. It will look like
/home/USERNAME/linbpq, so the full path should look like
/home/USERNAME/linbpq/sysinf.py. Also, don’t forget to replace
YOURUSER with the username used to run linbpq.
The script has been tested on Ubuntu 20.04, but it should run anywhere. Hope you enjoy it! Feel free to submit pull requests if you have any ideas for improvements.
One thought on “Monitoring System Stats via BPQ & Python”
Great post… Thanks for the link to my website.
I`m going to add your python script. Looks great.
73 Niels PD9Q