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
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
Post a Comment