[libvirt-users] Libvirt API for C/C++ : Monitoring Support

Eric Blake eblake at redhat.com
Thu Jan 12 22:44:23 UTC 2012

On 01/12/2012 12:04 AM, pratik.patel at snstech.com wrote:
> Greetings,
> I am a developer, trying to develop a system for monitoring Servers and Virtual Machines using Libvirt API for C/C++. I am facing an issue that there are no functions for monitoring some parameters which I have listed below. I would like to know if there is any there way I can retrieve these parameters since they are critical to my Monitoring Application. Also I am using CentOS 5.6 as a development machine which only supports up to libvirt-devel package version 0.8.2 due to which I am unable to use the newer development binaries (which are only built for newer RedHat kernels) which have support for certain functions that do not work on the one I am using.

Alas, you will have to upgrade to newer qemu and libvirt before you can
get at these values.  Some pieces of information are available if you
don't upgrade, but you are crippling your efforts if you don't upgrade.

> List of parameters:
> For Server Monitoring:
> 1. Memory Swap-In
> 2. Memory swap-Out

I'm not sure if these are yet exposed in libvirt 0.9.9, but it would be
reasonable to add them to virNodeGetMemoryStats.

> 3. Disk Usage

This one should be available for you, under virDomainGetBlockInfo

> 4. Disk Read
> 5. Disk write

These should be available under virDomainBlockStats[Flags], and

> 6. Disk Total Read Latency
> 7. Disk total Write Latency

I'm not sure if virDomainBlockStatsFlags and
VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES quite matches what you are
looking for; then again, total time spend on reads can probably get you
pretty close to calculating latency.

> 8. Network Usage
> 9. Network Packets Received
> 10. Network Packets Sent

virDomainInterfaceStats should be available for you

> 11. CPU utilization
> 12. CPU Usage

There's a proposal to add these; it should be in by 0.9.10...

> For Virtual Machine Monitoring:
> 1. Memory Utilization
> 2. Memory Consumption
> 3. Memory swap-In
> 4. Memory Swap-Out

Hmm, you make it sound like you want stats on both the host and on each
domain running on the host.  Again, many of these stats are already
available, and the things that aren't would be reasonable additions if
you don't mind contributing patches.

> 5. Disk Usage
> 6. Disk Read
> 7. Disk Write
> 8. Disk Total Read Latency
> 9. Disk total write Latency
> 10. Network Usage
> 11. Network Packets Received
> 12. Network Packets Transmitted
> 13. CPU utilization
> 14. CPU Usage

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120112/e401cb6e/attachment.sig>

More information about the libvirt-users mailing list