23.11.2020, 13:28
Create two objects with 2byte floating dpt, In my example they have names CPU and Memory
Code:
data = io.readfile('/proc/meminfo')
load = io.readfile('/proc/loadavg'):split(' ')[ 1 ]
memtotal = data:match('MemTotal:%s+(%d+)')
memavail = data:match('MemAvailable:%s+(%d+)')
memusage = math.floor((memtotal - memavail) / memtotal * 1000) / 10
log(load, memusage)
grp.update('CPU', load)
grp.update('Memory', memusage)
------------------------------
Ctrl+F5
Ctrl+F5