This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

System Load Variable
#2
Resident script with a 60-second sleep interval. 
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)
Reply


Messages In This Thread
System Load Variable - by pioneersteffen - 05.10.2024, 05:49
RE: System Load Variable - by Fahd - 05.10.2024, 20:17
RE: System Load Variable - by admin - 07.10.2024, 06:22

Forum Jump: