Resident script with a 60-second sleep interval.
Create two 2-byte objects and name them CPU and Memory.
Create two 2-byte objects and name them CPU and Memory.
Code:
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)