1

Is there an API for Java in getting the CPU usage of a VM in KVM? I want to know how I could get the CPU usage of a guest (from the host's perspective) using Java.

Also, does anybody know where I could find the source of virt-manager so I could learn how it gets/computes the CPU usage it displays in Virtual Machine Manager?

0

2 Answers 2

1

Perhaps one of the methods in Interface OperatingSystemMXBean be adapted to what you are looking for.

See http://docs.oracle.com/javase/7/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html

0
1

I do not know of any Java APIs which expose KVM but the source for virt-manager is accessible here in the official Git repo.

Additionally I'd look to the libvirt API for interacting with KVM or any other virtualization technology. Specifically there are Java bindings to the libvirt API.

2
  • Thank you sir. I've been to that website (Git repo of virt-manager) a lot of times since I've been researching for weeks but I couldn't manage to understand how the site works. Is it all right if you could briefly explain how it works? Thanks a lot sir. Commented Jul 6, 2014 at 17:41
  • @user3752288 - here's a link to the latest trunk version of the code base: git.fedorahosted.org/cgit/virt-manager.git/snapshot/…. It's tarred up for easier download. Commented Jul 6, 2014 at 17:59

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.