Hello. I've been finding a good solution to monitor virtual machines' status such as memory, disk, cpu, etc, and I found this as a tool for measuring disk/image status. I have a question while using the libguestfs-java library; I'd wanted to implement a sample app which retrieve the disk information remotely. Is there any way, i.e., specific API(s) to connect with a host where kvm/qemu has been installed from a remote node, to access and get VMs' disk related information remotely? I read JavaDoc and libguestfs-java sample code from http://libguestfs.org/guestfs-java.3.html, but I could not find such an example. Thanks in advance! best regards bgkim -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160106/cd860cce/attachment.htm>
Richard W.M. Jones
2016-Jan-06 10:00 UTC
[Libguestfs] Question how to implement remote access
On Wed, Jan 06, 2016 at 01:09:27PM +0900, BYEONG-GI KIM wrote:> Hello. > > I've been finding a good solution to monitor virtual machines' status such > as memory, disk, cpu, etc, and I found this as a tool for measuring > disk/image status. > > I have a question while using the libguestfs-java library; I'd wanted to > implement a sample app which retrieve the disk information remotely. Is > there any way, i.e., specific API(s) to connect with a host where kvm/qemu > has been installed from a remote node, to access and get VMs' disk related > information remotely? > > I read JavaDoc and libguestfs-java sample code from > http://libguestfs.org/guestfs-java.3.html, but I could not find such an > example.It's a good question actually. Using a remote libvirt connection will *not* work. Unless your disks are on shared storage, and are accessible using the same paths at the monitoring machine, in which case it might work. [To see if this could work, try doing the following command from the monitoring machine: virsh -c qemu+ssh://root at hypervisor.example.com/system dumpxml name_of_a_guest and if the command works and the paths in the returned libvirt XML are also valid on the local monitoring machine, then libguestfs may work remotely.] I suggest that you use a Java remoting library such as RMI, SpringSource remoting, JBoss remoting or others. It does mean that you'll need to run a small service (the Java RMI server) on each node. You can see a similar idea -- but implemented in Python -- here: https://rwmj.wordpress.com/2013/05/07/using-libguestfs-remotely-with-python-and-rpyc/ Another useful answer may be this one: https://www.redhat.com/archives/libguestfs/2011-May/msg00093.html Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top