[Libvir] a couple of questions -Newbie

I am really excited to start using this, but I have a couple of questions about how to use it exactly. I want to be able to pull a list of stats out of my Xen machines. I need to get something like network i/o. I just need to know how much in and out traffic that a specific machine is doing. I am pretty new to python and to programming in general. I have looked at the APi and stuff like that, but am a little confused still on how to actually do this. Mainly I just need to know how to connect to certain things. Once I have a basic understanding of what is going on then I can take it from there. Thanks for all the help! Spencer Parker

On Mon, Mar 03, 2008 at 11:14:05AM -0700, Spencer Parker wrote:
I am really excited to start using this, but I have a couple of questions about how to use it exactly. I want to be able to pull a list of stats out of my Xen machines. I need to get something like network i/o. I just need to know how much in and out traffic that a specific machine is doing. I am pretty new to python and to programming in general. I have looked at the APi and stuff like that, but am a little confused still on how to actually do this. Mainly I just need to know how to connect to certain things.
Once I have a basic understanding of what is going on then I can take it from there. Thanks for all the help!
There is a couple of C code examples at http://libvirt.org/examples/index.html unfortunately this is a bit lacking. Fetch the sources, you can find a directory python/tests with python examples. For 'how to connect' pass a connection URi to the connection creation call instead of NULL/None there are examples http://libvirt.org/uri.html That should not be too hard, really, and if you can contribute back a simple C example for statistics extraction I will add it, that could help the next person ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Mon, Mar 03, 2008 at 11:14:05AM -0700, Spencer Parker wrote:
I am really excited to start using this, but I have a couple of questions about how to use it exactly. I want to be able to pull a list of stats out of my Xen machines. I need to get something like network i/o. I just need to know how much in and out traffic that a specific machine is doing. I am pretty new to python and to programming in general. I have looked at the APi and stuff like that, but am a little confused still on how to actually do this. Mainly I just need to know how to connect to certain things.
You can actually just do this directly with virt-top: virt-top -csv file.csv You'll get a new line of stats in the CSV file every (by default) 3 seconds, and if you look at the "Net RXBY" and "Net TXBY" columns for each domain that will tell you bytes received and bytes sent in that 3 second period. You can also feed the CSV output into a pipe and process it using another program in real time. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (3)
-
Daniel Veillard
-
Richard W.M. Jones
-
Spencer Parker