Logic Machine Forum
System parameters - 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: System parameters (/showthread.php?tid=665)



System parameters - baggins - 09.03.2017

Hi,

I would like to log some system parameters such as cpu load, system temperature, memory, network activity, KNX bus activity, etc.

So far I have only been able to figure out cpu load (cat /proc/loadavg) and memory (free).

How can I get the other system parameters?


Thanks.


RE: System parameters - baggins - 12.03.2017

Nobody knows?

Thanks.


RE: System parameters - buuuudzik - 13.03.2017

Here you have some documentation which you can use to check some parameters(network, mounts, disk space):
proc file system
[url=https://www.centos.org/docs/5/html/5.1/Deployment_Guide/ch-proc.htmlhttps://www.centos.org/docs/5/html/5.1/Deployment_Guide/ch-proc.html][/url]
Example of checking memory usage:
Code:
f = assert (io.popen("cat /proc/meminfo"))
response = {}
for line in f:lines() do
 table.insert(response, line)
end -- for loop
 
f:close()
log(response)

Example of checking how many and what are the names of files on '/home/ftp/':
Code:
f = assert (io.popen ("ls /home/apps"))
response = {}
for line in f:lines() do
 table.insert(response, line)
end -- for loop
 
f:close()
log('There are ' .. #response .. ' files on the server.',response)



RE: System parameters - admin - 13.03.2017

For network activity, you can get current stats like this:
Code:
require('ifinfo')
stats = ifinfo().eth0
log(stats)

You will still have to store older values somewhere if you want to get stats for the current hour/day/etc.
There's no API for getting KNX stats at the moment, but it might get added in the next FW.


RE: System parameters - baggins - 13.03.2017

Thanks for this.

Where can I find info on temperature? I can't find it in the standard places. From time to time I have temperature warnings so I would like to keep track of this.


RE: System parameters - admin - 13.03.2017

TP-UART chip which generates temperature warning does not provide the temperature value Sad


RE: System parameters - baggins - 13.03.2017

Too bad [Image: sad.png]

I might try to stick a 1-wire temp sensor to the LM just to have some indication...


RE: System parameters - Thomas - 13.03.2017

Hi
How about KNX BUS load? Is there this value available in LM?
Thank you.


RE: System parameters - admin - 13.03.2017

In next FW release there will be a function called knxlib.getstats() which will return the numbe of IP and TP telegrams sent/received. Total bus load can be calculated from these values.


RE: System parameters - buuuudzik - 13.03.2017

(13.03.2017, 10:33)Thomas Wrote: Hi
How about KNX BUS load? Is there this value available in LM?
Thank you.

You can also do something like this:
Code:
-- Checking how many object from database was updated in last 5 seconds
delta=os.microtime() - 5
query = "SELECT name FROM objects WHERE updatetime>" .. delta
updated = db:getall(query)

log(#updated)

It gives an info about how many objects from database was updated in the last 5 seconds(if 1 object was updated a few times in this 5 seconds it would't be counted). You can also change this 5 second to other value e.g. 1s.


RE: System parameters - Erwin van der Zwart - 13.03.2017

Hi,

This also include grp.update and is not part of the busload, combined with the multiple triggered items within the time period it's not a trustfull methode..

I would wait for next FW where new knx.lib function will be available..

BR,

Erwin