Logic Machine Forum
Script : CPU alert - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Script : CPU alert (/showthread.php?tid=770)



Script : CPU alert - hfebraud - 03.05.2017

Hi everybody,

Is there anyone who know how to have the CPU charge of the system ?

In fact we'd like to get an alert, in case of CPU overclocked...

Thanks for your solutions,
Best regards,


RE: Script : CPU alert - buuuudzik - 03.05.2017

Here you have this script:
Code:
f = assert (io.popen("cat /proc/loadavg"))
loadavg = {}
for line in f:lines() do
 table.insert(loadavg, line)
end -- for loop
 
f:close()

log(loadavg)

First 3 values means averaged 1min, 5min, 15min where 0 means 0% and 1 means 100%. Further values are current number of runnable tasks and the process ID of the process that most recently ran.

See also:
http://www.loadavg.com/2012/01/what-is-loadavg/


RE: Script : CPU alert - hfebraud - 04.05.2017

Thanks a lot buuuudzik, it works !

Have a nice day


RE: Script : CPU alert - buuuudzik - 04.05.2017

You're welcomeSmile