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







Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

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

Webcam streaming throught VLC with YUY2 compatibility