How to add CPU load value to your InfluxDB with bash scripting

First, we going to create a database with an example value, like this example:

Now, with a bash script we going to write to our database the first value from /proc/loadavg, every 5s:

while true; do curl -i -XPOST 'http://localhost:8086/write?db=stat' --data-binary "cpu,host=SERVER001 value=`cat /proc/loadavg | awk '{print $1}'`"; sleep 5;done


Popular posts from this blog

from: can't read /var/mail/ in Python scripts

How to fix Android when developer options are not available for this user

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04