Subject: Re: [vserver] monitoring all contexts? (super context!)
From: Corey Wright <undefined@pobox.com>
Date: Tue, 9 Mar 2010 09:51:49 -0600
Tue, 9 Mar 2010 09:51:49 -0600
On Tue, 09 Mar 2010 14:01:21 +0000
Ed W <lists@wildgooses.com> wrote:

> Hi, I would like to run iotop to examine some performance counters, but 
> simply running it on the host obviously doesn't show the guest processes.
> 
> So instead I try using context 1
> 
>      chcontext --ctx 1 iotop
> 
> However, this gives me an error about missing /proc/vmstat, and in fact 
> if I change the above command to an "ls" then it's absolutely correct 
> that context 1 cannot see the full /proc tree
> 
> I'm running 2.6.32.8-grsec2.1.14-vs2.3.0.36.29.1 - how can I run iotop 
> (or any arbitrary command) in a context which can see all guest 
> processes AND have full access to the /proc filesystem?

i'm not running with the grsec patch, but i believe the attached
script/wrapper deals with your /proc problem (if i remember correctly).

corey
-- 
undefined@pobox.com


#!/bin/sh

# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
# based on vtop by Jacques Gelinas
#  
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#  
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#  
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#Presents the processes running in all virtual servers
: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
test -e "$UTIL_VSERVER_VARS" || {
    echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would
be expected); aborting..." >&2
    exit 1
}
. "$UTIL_VSERVER_VARS"

$__SBINDIR/setattr --watch /proc/vmstat
exec $__SBINDIR/chcontext --silent --ctx 1 iotop "$@"