script to monitor domU usage from ml

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

script to monitor domU usage from ml

Wensheng Wang
On 6/8/05, [hidden email]
<[hidden email]> wrote:

> Send Xen-users mailing list submissions to
>         [hidden email]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users
> or, via email, send a message with subject or body 'help' to
>         [hidden email]
>
> You can reach the person managing the list at
>         [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Xen-users digest..."
>
>
> Today's Topics:
>
>    1. Monitoring domU resource usage (Andy Smith)
>    2. Re: Monitoring domU resource usage (Tom Brown)
>    3. Re: trying to boot dom0 kernel: nothing happens (John Bucy)
>    4. Re: supported distributions (Arijit Ganguly)
>    5. Re: supported distributions (James Bulpin)
>    6. Re: supported distributions (Daniel Meinhold)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 8 Jun 2005 16:09:48 +0000
> From: Andy Smith <[hidden email]>
> Subject: [Xen-users] Monitoring domU resource usage
> To: Xen-users <[hidden email]>
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="us-ascii"
>
> Using 2.0-testing, what methods are people using to monitor
> individual domU CPU usage?
>
> Obviously I can run an snmpd in each domU and see how busy the CPU
> is, but that could be tampered with from inside the domU, and as the
> domU doesn't know it doesn't have the whole cpu needs some
> interpretation.
>
> I can see CPU time used in "xm list" but that looks like rather a
> blunt tool - would I have to do something like this for example:
>
> Name              Id  Mem(MB)  CPU  State  Time(s)  Console
> Domain-0           0      507    0  r----   7644.0
> foo                1      127    1  -b---   2585.9    9601
> bar                2       63    1  -b---    147.6    9602
>
> (5 minutes later)
>
> Name              Id  Mem(MB)  CPU  State  Time(s)  Console
> Domain-0           0      507    0  r----   7841.5
> foo                1      127    1  -b---   2593.2    9601
> bar                2       63    1  -b---    184.9    9602
>
> dom0 has used 7841.5-7644.0=197.5 seconds, foo used 7.3s, bar used
> 37.3s.  In 5 minutes there are 300 seconds so dom0 used
> 197.5/300*100=65.83% CPU, foo 2.43%, bar 12.43%, machine was 19.31%
> idle or overhead.
>
> That still doesn't give a way to tell how much CPU a domU *wanted*
> to have, though.  i.e. if a domU could make use of more CPU share if
> given it.
>
> Andy
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 189 bytes
> Desc: Digital signature
> Url : http://lists.xensource.com/archives/html/xen-users/attachments/20050608/f200d8ee/attachment.pgp
>
> ------------------------------
>
> Message: 2
> Date: Wed, 8 Jun 2005 10:17:40 -0700 (PDT)
> From: Tom Brown <[hidden email]>
> Subject: Re: [Xen-users] Monitoring domU resource usage
> To: Andy Smith <[hidden email]>
> Cc: Xen-users <[hidden email]>
> Message-ID:
>         <[hidden email]>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> On Wed, 8 Jun 2005, Andy Smith wrote:
>
> > Using 2.0-testing, what methods are people using to monitor
> > individual domU CPU usage?
> >
> > Obviously I can run an snmpd in each domU and see how busy the CPU
> > is, but that could be tampered with from inside the domU, and as the
> > domU doesn't know it doesn't have the whole cpu needs some
> > interpretation.
> >
> > I can see CPU time used in "xm list" but that looks like rather a
> > blunt tool - would I have to do something like this for example:
>
> AFAIK, from what you describe you don't have much choice, you are going to
> have to watch from _both_ the inside and the outside. I guess you might be
> able to guess which domU is requesting CPU if the total CPU on the box
> goes to 100%.
>
> I have a script that polls xm list ever 60 seconds and logs the results.
> >From this I can get a feeling for what % of the CPU is being consumed and
> which dom is using it...
>
> e.g.
>
> [root@xen1 ~]# more ~tbrown/uptime.log.xen
> Wed Jun  8 00:00:01 PDT 2005
>   Domain-0  2.48% cpu usage  102461.38 sec over 47.91 days
> domain-dns 16.91% cpu usage  501043.99 sec over 34.30 days
>    mailman  0.70% cpu usage  6938.28 sec over 11.53 days
>         mx 27.56% cpu usage  605861.02 sec over 25.44 days
>
>   1   7   1  20  68
>   1  11   2  27  55
>   3  96   0  35 -36
>   2  48   0  26  21
>   1   8   0  32  56
>   1   5   0  31  60
>   2   6   0  38  51
>   1  12   0  21  64
>   2  13   0  34  49
>   2  21   0  36  37
>   1   8   0  31  57
>   2  14   0  34  48
>
>
> Where the columns are the doms in the order described in the header... and
> the last column being idle time.
>
> hhmm, the script is only 67 lines... I will include it...
> The polling frequency and number of samples to take are
> commandline parameters, I run it hourly as "script 60 59" in my
> crontab.
>
> here goes:
>
> #!/usr/bin/perl
> #
> # script to dump CPU stats for VMs
> #
> # vim:ai
>
> use strict;
>
> my $interval = shift || 5;
> my $num_samples = shift || 0;
>
> my $uptime = `cat /proc/uptime`;
> $uptime =~ s/ .*$//g; # trim from first space, should leave us uptime in
> secs
>
> my $XM="/usr/sbin/xm";
>
>
> my $loop = 0;
> my $lasttimestamp = 0;
> my %lastcpu = ();
> while ( ++$loop ) { # loop forever
>    my $buf = '';
>    my $count = 0;
>    my $dat = `$XM list -l`
>       or die "no output from $XM list ?? maybe it isn't in your path?";
>    my $datatimestamp = time();
>    $dat =~ tr/\(\)/{}/;  # for readability of regex below.
>    my $totcpu = 0;
>
>    while ( my($dom,$rest) = ($dat =~ m/^(.*?\n})(.*)$/gs ) ) {
>       my ($domcpu) = ($dom =~ m/{cpu_time\s([\d\.]+)}/)
>          or die "couldn't extract cpu_time from $dom on dom $count\n";
>       my ($domup) = $uptime;
>       if ($count > 0 ) {
>          ($domup) = ($dom =~ m/{up_time\s([\d\.]+)}/)
>             or die "couldn't extract up_time from $dom on dom $count\n";
>       }
>       my $domname = "dom-$count";
>       {
>          my ($tmp) = ($dom =~ m/{name\s(.+)}/);
>          $domname = $tmp if ($tmp);
>       }
>
>       if ($loop <= 1) {
>          $buf .= sprintf "%10s %5.2f%% cpu usage  %.2f sec over %.2f days\n",
>             $domname, 100 * $domcpu/$domup, $domcpu, $domup/24/3600;
>       } else {
>          my $cpu = $domcpu-$lastcpu{$count};
>          $totcpu += $cpu;
>          $buf .= sprintf "%3d ",
>             100 * $cpu/$interval;
>       }
>       $lastcpu{$count} = $domcpu;
>       $dat = $rest;
>       $count++;
>       die "count exceeded" if ($count > 100);
>    }
>    my $period = ($datatimestamp - $lasttimestamp);
>    if ($loop > 1) {  # add on idle cpu
>       $buf .= sprintf "%3d", 100 * ($interval - $totcpu)/$period;
>    }
>    $lasttimestamp = $datatimestamp;
>    print "$buf\n";
>    exit if ($num_samples && $loop > $num_samples);
>    sleep $interval;
> }
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 8 Jun 2005 13:27:03 -0400
> From: John Bucy <[hidden email]>
> Subject: Re: [Xen-users] trying to boot dom0 kernel: nothing happens
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> On Mon, Jun 06, 2005 at 07:22:18PM -0400, John Bucy wrote:
> >
> > I'm trying to boot the 2.0.6 binary distribution on an SMP dell box.
> > The dom0 is a debian/sarge installation that's maybe 2 months
> > out-of-date. Not knowing otherwise, I suspect that SMP/ACPI is the
> > source of trouble here.  I've tried various permutations of the boot
> > options for both xen and the dom0 kernel and they don't seem to have
> > much effect.  In particular, nosmp/acpi=off doesn't seem to prevent it
> > from parsing the bios tables, etc.
>
> The same binaries boot on my laptop so I'm inclined to believe that
> the SMP box is the source of trouble.  I don't really care about this
> particular machine -- it was what I had lying around for testing -- but
> someone else might.
>
>
>
>
> john
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 8 Jun 2005 11:14:34 -0700
> From: Arijit Ganguly <[hidden email]>
> Subject: Re: [Xen-users] supported distributions
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I guess the reason why it is failing is the lack of driver support for dual
> drive bus existing on dell pe1800.
>
> Besides, I have also been trying to recompile the kernel but end up getting
> an error in some driver.c file.
>
> I did the following:
> Inside: xen-2.0
> make world
> cd linux-2.6.10-xen0
> make ARCH=xen menuconfig
> //selected my drivers and modules
> make
> I get error in balloon.c, in function balloon_process
> line 210: phys_to_machine_mapping undeclared
> line 210: INVALID_P2M_ENTRY undeclared.
>
> any clues
> Arijit
>
>
>
> On 08 Jun 2005 10:26:22 +0100, James Bulpin <[hidden email]> wrote:
> >
> > You probably need an initrd (even if the block device driver is compiled
> > in).
> >
> > mkinitrd /boot/initrd-2.6.10-xen0.img 2.6.10-xen0
> >
> > and add the corresponding line to grub
> >
> > module initrd-2.6.10-xen0.img
> >
> > James
> >
> > On Wed, 2005-06-08 at 01:42, Arijit Ganguly wrote:
> > > I rebuilt my custom kernel, with extensive support for RAID.
> > > I am still not able to boot XenLinux.
> > >
> > > These are the last few lines that I see before the system reboots.
> > >
> > > md: autodetecting RAID arrays
> > > md: autorun DONE
> > > Root-NFS: No NFS server available
> > > VFS: unable to mount rootsfs via NFS, trying floppy
> > > VFS: insert root floppy and press enter
> > > Cannot open root=sda5 or unknown block(2,0)
> > >
> > > One another note my boot device is /dev/sda5, just to make sure that
> > > Xen may have issues with extended and primary partitions.
> > >
> > > any clues.
> > >
> > > Arijit
> > >
> > > Arijit
> > >
> > >
> > > On 6/7/05, Mark Porter <[hidden email]> wrote:
> > > If you used the xen installer, it installed a kernel with
> > > very limited
> > > support for block devices. It looks like you are using at
> > > least a SCSI
> > > HBA or maybe even a RAID controller. The driver for this
> > > interface is
> > > probably not in the default kernel. Most distributions either
> > > install a
> > > kernel with the driver for your hardware built-in or an
> > > initial ram
> > > disk image with the driver.
> > >
> > > The easiest solution is to
> > > download the source, and expand the xen-2.0 directory
> > > cd to the xen-2.0 directory and run "make world"
> > > cd into the linux-2.6.11-xen0 directory and run "make
> > > ARCH=xen
> > > xconfig" (or menuconfig if you don't have X)
> > > build whatever drivers you need for the hard drives into
> > > the
> > > kernel, make modules for everything else (usb support, other
> > > filesystems, network cards, etc)
> > > cd ../ to the xen-2.0 directory
> > > run "make install"
> > >
> > > That should build and install your custom kernel.
> > >
> > > Good luck,
> > > Mark
> > >
> > > Arijit Ganguly wrote:
> > >
> > > >All,
> > > >
> > > >I was wondering what distributions of linux are supported
> > > inside Xen. I
> > > >built the Xen kernel image on my Red Hat Enterprise 3
> > > machine, and then
> > > >specify the menu.conf entry as:
> > > >title Xen
> > > >kernel xen.gz dom0_mem=128000
> > > >module vmlinuz-2.6.10-xen0 root=/dev/sda6 ro console=tty0
> > > >
> > > >When I boot this image, I get an error like
> > > >unable to mount root sda6
> > > >
> > > >Ithe Red Hat Enterprise3 image however mounts it perfectly
> > > fine.
> > > >
> > > >My machine is dell pe1800 dual processor (server class). i
> > > hope Xen is not
> > > >just confined to desktops, because it wrked fine on a debian
> > > desktop.
> > > >
> > > >Arijit
> > > >
> > > >
> > > >
> > >
> > >------------------------------------------------------------------------
> > > >
> > > >_______________________________________________
> > > >Xen-users mailing list
> > > >[hidden email]
> > > >http://lists.xensource.com/xen-users
> > > >
> > >
> > >
> > >
> > > ______________________________________________________________________
> > >
> > > _______________________________________________
> > > Xen-users mailing list
> > > [hidden email]
> > > http://lists.xensource.com/xen-users
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.xensource.com/archives/html/xen-users/attachments/20050608/ce65077c/attachment.html
>
> ------------------------------
>
> Message: 5
> Date: 08 Jun 2005 19:18:35 +0100
> From: James Bulpin <[hidden email]>
> Subject: Re: [Xen-users] supported distributions
> To: Arijit Ganguly <[hidden email]>
> Cc: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain
>
> On Wed, 2005-06-08 at 19:14, Arijit Ganguly wrote:
> > I guess the reason why it is failing is the lack of driver support for
> > dual drive bus existing  on dell pe1800.
> >
> > Besides, I have also been trying to recompile the kernel but end up
> > getting an error in some driver.c file.
> >
> > I did the following:
> > Inside: xen-2.0
> > make world
> > cd linux-2.6.10-xen0
> > make ARCH=xen menuconfig
> > //selected my drivers and modules
> > make
>
> try "make ARCH=xen" instead.
>
> > I get error in balloon.c, in function balloon_process
> > line 210: phys_to_machine_mapping undeclared
> > line 210: INVALID_P2M_ENTRY undeclared.
> >
> > any clues
> > Arijit
>
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 08 Jun 2005 20:18:56 +0200
> From: Daniel Meinhold <[hidden email]>
> Subject: Re: [Xen-users] supported distributions
> To: Arijit Ganguly <[hidden email]>
> Cc: [hidden email]
> Message-ID: <1118254736.5550.32.camel@blackbox>
> Content-Type: text/plain; charset="us-ascii"
>
> Am Mittwoch, den 08.06.2005, 11:14 -0700 schrieb Arijit Ganguly:
> > I guess the reason why it is failing is the lack of driver support for
> > dual drive bus existing  on dell pe1800.
> >
> > Besides, I have also been trying to recompile the kernel but end up
> > getting an error in some driver.c file.
> >
> > I did the following:
> > Inside: xen-2.0
> > make world
> > cd linux-2.6.10-xen0
> > make ARCH=xen menuconfig
> > //selected my drivers and modules
> > make
> > I get error in balloon.c, in function balloon_process
> > line 210: phys_to_machine_mapping undeclared
> > line 210: INVALID_P2M_ENTRY undeclared.
>
> you need to append ARCH=xen to your make command
> e.g.
>
> make ARCH=xen menuconfig
> make ARCH=xen all
>
> Cheers,
>
> Daniel
>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 189 bytes
> Desc: Dies ist ein digital signierter Nachrichtenteil
> Url : http://lists.xensource.com/archives/html/xen-users/attachments/20050608/4081bf11/attachment.pgp
>
> ------------------------------
>
> _______________________________________________
> Xen-users mailing list
> [hidden email]
> http://lists.xensource.com/xen-users
>
>
> End of Xen-users Digest, Vol 4, Issue 22
> ****************************************
>

_______________________________________________
Xen-users mailing list
[hidden email]
http://lists.xensource.com/xen-users