Subject: Re: [vserver] monitoring all contexts? (super context!)
From: Corey Wright <undefined@pobox.com>
Date: Tue, 9 Mar 2010 10:05:29 -0600
Tue, 9 Mar 2010 10:05:29 -0600
On Tue, 9 Mar 2010 09:51:49 -0600
Corey Wright <undefined@pobox.com> wrote:

> 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).

here's a more concise view (ie hides all the boilerplate) of the difference
between vtop (on which i based the script) and viotop.

it also gives credit where credit is due (ie i plagiarized vtop ;-).

corey
-- 
undefined@pobox.com


--- /usr/sbin/vtop	2008-12-12 22:56:30.000000000 -0600
+++ /usr/local/sbin/viotop	2009-05-21 11:07:50.000000000 -0500
@@ -25,4 +25,5 @@ test -e "$UTIL_VSERVER_VARS" || {
 }
 . "$UTIL_VSERVER_VARS"
 
-exec $__SBINDIR/chcontext --silent --ctx 1 top "$@"
+$__SBINDIR/setattr --watch /proc/vmstat
+exec $__SBINDIR/chcontext --silent --ctx 1 iotop "$@"