[Lxc-users] Gathering information about containers - from inside and from outside
Daniel Lezcano
daniel.lezcano at free.fr
Sun Jul 18 12:39:43 UTC 2010
On 07/18/2010 11:48 AM, Clemens Perz wrote:
> Hi,
>
> I was just searching my system for any status information about my
> running containers, cause I want to start writing a script that collects
> and displays this.
>
> So doing a while on /var/lib/lxc as a starting point, run lxc-info on
> each, find out which one is running, examine its cgroup and so on.
You should look for the abstract socket "@/var/lib/lxc/<name>/command"
too. This socket exists when the container is running. The container can
run without a previous creation, hence you won't find it in
/var/lib/lxc. These containers are called "volatile containers".
> I have three macvlan containers running, but funny enough lsmod shows
> that the macvlan module is not used.
Do you mean the refcount is 0 ? or the module is not visible ?
> I cant find any entries in proc or
> sys that would tell me anything about the existance of the network
> interfaces for the containers.
You can access these informations via /proc. Let's say on the host, the
init pid is 1234, then you can look at:
cat /proc/1234/root/proc/1/net/dev
But you won't be able to get the IP address.
At present, there is some work to make possible to 'attach' a container
but it is not yet merged in the upstream kernel. With the attach, it
will be possible to gather all the container information.
> Can I find them at all? Could lxc-info be
> extended to be verbose and tell you more in a parseable way?
Yes, absolutely. that would be nice to extend the lxc-info :)
> I have adapted a similar thing I wrote for vserver and this is how it
> might look like:
>
> Container Boot Status M-PID IP Load
> --------------------------------------------------------------------
> CVS01 AUTO UP 40003 10.100.100.11 0.00 0.00 0.00
> MAILE man down -- 10.100.100.12 --
> CVS02 AUTO UP 105 10.100.100.13 0.00 0.00 0.00
>
> Guess the load might be an idea for the future :)
yep :)
Thanks
-- Daniel
More information about the lxc-users
mailing list