EPIC and RIO Used CPU and Memory - Example Flow

We have a flow to show you how much free disk space you have;

We also have a flow to show you your CPU temperature;

But we had a customer ask to how to show used CPU and used memory… So here is a flow to do that…

The flow is very simple.
Every 10 seconds (but feel free to change it for your needs) we fire the inject button and two different Exec Nodes get the data.
In this example flow I simply show it in the debug tab, but you could move it into some PAC Control tags and display (and alert) it via groov View, or you could send them to an MQTT Broker.

The units for the memory payload is Mb and the units for the CPU is %.

Here is the flow to import in the usual way.

[{"id":"f992b860.36e6c8","type":"inject","z":"ee0dce29.d9a52","name":"10 seconds","repeat":"10","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":410,"y":540,"wires":[["d73737d0.705a98","ae4c40bc.34eab8"]]},{"id":"d73737d0.705a98","type":"exec","z":"ee0dce29.d9a52","command":"top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}'","addpay":false,"append":"","useSpawn":"","timer":"","name":"CPU Load","x":650,"y":500,"wires":[["fe89304.db3445"],[],[]]},{"id":"ae4c40bc.34eab8","type":"exec","z":"ee0dce29.d9a52","command":"free | grep Mem | awk '{print 100*($4+$6+$7)/$2}'","addpay":false,"append":"","useSpawn":"","timer":"","name":"Memory Used","x":660,"y":580,"wires":[["4486500e.db36a"],[],[]]},{"id":"fe89304.db3445","type":"debug","z":"ee0dce29.d9a52","name":"","active":true,"console":"false","complete":"false","x":950,"y":500,"wires":[]},{"id":"4486500e.db36a","type":"debug","z":"ee0dce29.d9a52","name":"","active":true,"console":"false","complete":"false","x":950,"y":580,"wires":[]}]
1 Like