What to use on a Linux server to get a simple HTTP API to fetch system stats?

I have a 2 personal servers with Ubuntu 20.04 that I'd like to build a NodeRed monitoring dashboard for with NodeRed running on my Pi. I'd like to see this sort of info:

    ServerName: ONLINE or OFFLINE since $TIMESTAMP
    CPU used: 30% (or that X Y Z cpu load info)
    Memory used: 60%
    /dev/sda1 free: 40%
    /dev/sda2 free: 90%

So I'd like some way to easily slap an HTTP API on my servers to get this system info in JSON format. Any suggestions? I'm hoping for something that already works and designed for this, that I can install and forget about it, without having to spend ages configuring it.

I know I could use one of those contrib ssh nodes, and use "ssh user@server1 df -h && free -h && whatever-for-cpu" and parse the text output, but I'd rather work with HTTP/JSON than do text parsing tbh.

You could install node-red on the servers and pass the info to the pi using MQTT.

However a better way to collect the data might be with SNMP. That tool is designed for just these applications.

Both glances and Open Hardware Monitor provide an API with the info you're after in JSON format.


Programs, like glances and others use often the psutils python library.
You can run a python script on your Linux machines, called psmqtt.
see: GitHub - eschava/psmqtt: Utility reporting system health and status via MQTT.

If you run this script as a service, you do not need to worry about it, after starting up your computer and it will publish all your data to a MQTT broker.

With Node Red you can handle the data quite easily.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.