[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH 0/3] virt-top stream mode



On Wed, Jan 26, 2011 at 01:41:31PM +0900, KAMEZAWA Hiroyuki wrote:
> 
> Now, virt-top has no option to dump information to stdout.
> 
> Considering usual top, I know some admins tend to do
> 
>  top -b | awk.... or his own script
> 
> to check his system.
> 
> I wondered --csv + --script + pipe by mknod may be able to give us
> the same behavior but I think it can't, finally. Because
> preparing pipe and delete it for each script is not good and
> csv file format doesn't much enough for usual scripts which
> use regular expressions and check lines one by one.
> 
> This patch adds --stream mode.
> 
> [Output example]
> ==
> [root bluextal virt-top-1.0.5]# ./virt-top/virt-top --stream
> virt-top time  13:40:40 Host bluextal x86_64 8/8CPU 1999MHz 24033MB
>    ID S RDRQ WRRQ RXBY TXBY %CPU %MEM   TIME    NAME
>     5 R    0    0    0    0  0.0 34.0 503:52.43 RHEL6
> virt-top time  13:40:43 Host bluextal x86_64 8/8CPU 1999MHz 24033MB
>    ID S RDRQ WRRQ RXBY TXBY %CPU %MEM   TIME    NAME
>     5 R    0    0  104    0  0.7 34.0 503:52.60 RHEL6
> ==
> 
> In this version, only supports "show domain" and "sort by ID".
> 
> To be honest, this is the 1st time for me to write program in ocaml.
> I'm sorry if my code seems ugly or I misunderstand something.
> 
> Patches are divided into 3 patches.
> 1/3 .... add --stream mode. with dummy function.
> 2/3 .... fill dummy function to show domain data to stdout.
> 3/3 .... documentation.

There's nothing wrong with the patch, but I wonder in general
if you could use --csv /dev/stdout to do this instead:

  virt-top -b --script --csv /dev/stdout

See:

  https://bugzilla.redhat.com/show_bug.cgi?id=643893#c10

CSV is much more predictable to parse than plain text.  For an example
of parsing the CSV output of virt-top, see:

  https://bugzilla.redhat.com/attachment.cgi?id=472065

Anyway let me know which is more suitable, because the patch does look
OK and would be acceptable if there's a pressing reason for it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]