ThingSpeak can be used to easily monitor CPU usage %, memory usage %, and disk usage % on any Linux machine connected to the internet.
First, create a new Channel, and fill out the field names as follows: Field 1 = “CPU Usage (%)”, Field2 = “Memory Usage (%)”, Field 3 = “Disk Usage (%)”.
Next, add the open-source server statistics script to your server, which can be found at: https://raw.githubusercontent.com/iobridge/thingspeak/master/lib/server_stats.sh
Inside the script there’s an API Key variable, which should be replaced with your specific Channel’s API Key (leave the single quotes, and only replace the X’s):
For the script to work properly, install the “bc” package via:
Then make the script executable:
Finally, edit your crontab file:
Make the script execute every minute by adding this line to your crontab (make sure you use the proper path to the script):
The script will then automatically POST server stats to the Channel specified by the API Key every minute.
You can see some of the ThingSpeak server statistics here: