lua to read Linux, Solaris, FreeBSD kernel statistics

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

lua to read Linux, Solaris, FreeBSD kernel statistics

Stefan Parvu-2
Hi,

Anyone, any ideas if there is anything done in Lua which can read /proc from Linux or
sysctl interface from *BSD systems. Im interested to use Lua to fetch system statistics:

 * cpu, memory utilization
 * disk, nic utilization

and find out if I could port some of the Kronometrix perl data recorders to Lua. I want to
make the data recorder package even smaller but keep a scripting language rather than
use C.

http://www.kronometrix.org/recording/agents.html

Many thanks,

--
Stefan Parvu <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: lua to read Linux, Solaris, FreeBSD kernel statistics

David Favro
On 02/21/2015 05:59 AM, Stefan Parvu wrote:
> Anyone, any ideas if there is anything done in Lua which can read /proc from Linux or
> sysctl interface from *BSD systems. Im interested to use Lua to fetch system statistics:
>
>   * cpu, memory utilization
>   * disk, nic utilization

I've always just coded up a quick parse of Linux /proc/foo when necessary,
which is typically very easy using Lua string pattern matching.  If you want
an API to return various utilization statistics that is platform-independent
across Linux & BSD, I'm not aware of one but I think you could code it
yourself very easily.

A Linux-only example below, works on 2.6 and 3.X kernels.  I'm not a VM
expert, so your interpretation of what constitutes "free memory" may be
different.


meminfo.lua (679 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: lua to read Linux, Solaris, FreeBSD kernel statistics

Stefan Parvu-2

Thanks for message.

> I've always just coded up a quick parse of Linux /proc/foo when necessary,
> which is typically very easy using Lua string pattern matching.  If you want
> an API to return various utilization statistics that is platform-independent
> across Linux & BSD, I'm not aware of one but I think you could code it
> yourself very easily.

Yes, probable I need to think a bit further. Would make sense we could
have a module which can get stats from Linux, *BSD and Solaris or even
Windows with a consistent API.

Definitive something I need to think about it.

Cheers,

--
Stefan Parvu <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: lua to read Linux, Solaris, FreeBSD kernel statistics

Jeff Pohlmeyer
In reply to this post by Stefan Parvu-2
On Sat, Feb 21, 2015 at 4:59 AM, Stefan Parvu wrote:


> Anyone, any ideas if there is anything done in Lua which can read /proc from Linux or
> sysctl interface from *BSD systems. Im interested to use Lua to fetch system statistics:


There is something here that might be interesting:
  http://luaforge.net/projects/lua-statgrab/
  http://www.i-scream.org/libstatgrab/

 - Jeff

Reply | Threaded
Open this post in threaded view
|

Re: lua to read Linux, Solaris, FreeBSD kernel statistics

Daurnimator
In reply to this post by Stefan Parvu-2
On 21 February 2015 at 05:59, Stefan Parvu <[hidden email]> wrote:
Hi,

Anyone, any ideas if there is anything done in Lua which can read /proc from Linux or
sysctl interface from *BSD systems. Im interested to use Lua to fetch system statistics:

 * cpu, memory utilization
 * disk, nic utilization

and find out if I could port some of the Kronometrix perl data recorders to Lua. I want to
make the data recorder package even smaller but keep a scripting language rather than
use C.

http://www.kronometrix.org/recording/agents.html

Many thanks,

--
Stefan Parvu <[hidden email]>


There is a whole project "Heka" https://hekad.readthedocs.org/ that is for reading misc stats files, log outputs etc.


Reply | Threaded
Open this post in threaded view
|

Re: lua to read Linux, Solaris, FreeBSD kernel statistics

Stefan Parvu-2

> There is a whole project "Heka" https://hekad.readthedocs.org/ that is for
> reading misc stats files, log outputs etc.

thanks for pointer. Did not know about it. I need to take a look, seems enough
big and more powerful than basic dummy recorders which should work 24x7
no matter what. But this project might be interesting from another angle. I need
to think about it.

The simplest, would be what libstatgrab folks are doing. A generic UNIX library
which can read Linux, FreeBSD, Solaris more or less. A library designed for
performance monitoring. Trouble with libgrabstat is that it is very experimental and
requires more testing ... , for example does not support per cpu statistics. We have
been testing it last summer.


--
Stefan Parvu <[hidden email]>