[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: any way to issue a statfs() in Lua ?
- From: Coda Highland <chighland@...>
- Date: Fri, 15 Mar 2013 08:19:08 -0700
Write a Lua C API function that does the work, or use LuaJIT and use
the FFI. I recommend using the FFI, because using the C API means you
have to either write a C library to be loaded by Lua or you have to
write a program that embeds the Lua interpreter, and at that point
your "as lightweight as possible" starts leaning toward "write it in
pure C" in my opinion (not that either of these solutions are any
heavier than using the standalone Lua interpreter, but if you're
writing C code anyway, might as well go all the way).
On Fri, Mar 15, 2013 at 7:50 AM, Laurent Faillie <firstname.lastname@example.org> wrote:
> I wonder if their is anyway to do a statfs() from Lua ?
> Statfs() is the internal function used by unix' df command to retrieve
> file-system usage. I'm working on a monitoring tool (à la Nagios) but I
> would like to have it as lightweight as possible : it's why the monitor
> is in Lua and I would like to avoid as much as possible to fork()
> eternal processes as it's heavy for the host ; So no exec() if possible.
> I've been able to retrieve cpuload and memory usage directly in Linuxs
> /proc but nothing regarding disk usage :(