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

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

Exception: Could not find a default OpenFlow controller in Mininet

v4l2: open /dev/video0: Permission denied