pcp
[Top] [All Lists]

PCP libvirt PMDA

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: PCP libvirt PMDA
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Tue, 12 Jul 2016 12:01:14 +0300
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2
Hi,

Based on the earlier toy / example PCP libvirt PMDA I sent earlier,
here's a real libvirt PMDA which should be ready for merging.

In addition to domain information from XML description, we now also
provide some basic metrics for the hypervisor and, more importantly, all
metrics available for domains (VMs). Some of the metrics are of course
dependent on the platform support so for example the libvirt perf
metrics will be available only if supported by the CPU and then enabled
in libvirt.

Tested on RHEL 7 / Python 2 / Python 3 / libvirt 2 API. Some metrics are
not available on earlier versions of the API, in such cases the PMDA
still provides values for the available metrics.

As a convenience for those who might want to try this out before the
next PCP release, I've uploaded the PMDA code to my fedorapeople page
(and sent the actual patch off-list):

https://myllynen.fedorapeople.org/pmdalibvirt/

Few notes:

- the types/semantics/units descriptions for metrics are based on
libvirt docs and sources but if you spot anything there (or can suggest
better naming or description), let me know

- domain information is refreshed when any of the libvirt.dominfo.*
metrics are requested, if it turns out that it should be done more often
we can revisit this but so far this seems to be an ok approach (since
I'd expect that something like libvirt.dominfo.name would be requested
as well when requesting domain metrics)

- there might be room for some micro-optimizations but on higher level
the most important aspect is that the metrics are in different clusters
so requests for certain types of metrics causes no additional overhead
(and, of course, unused metrics won't cost anything)

- I don't have an Intel CQM (Cache QoS Monitoring) capable CPU at hand
for testing (although a colleague might provide some test results a bit
later) but reading libvirt docs and source strongly suggest they should
be ok as-is (and as can be seen from the code, changes such for PMDA
metrics should be a matter of a line or two in the worst case anyway)

- libvirt API provides VM metrics for individual vCPUs/NICs/block
devices but since instance IDs are the domain UUIDs in the PMDA, it's
unclear what would be the optimal approach to provide those (dynamic)
device metrics as PCP metrics. Thus the PMDA combines these together.

Finally, here's a screenshot of available metrics with help texts:

$ pminfo -t libvirt
libvirt.dominfo.uuid [VM UUID]
libvirt.dominfo.name [VM name]
libvirt.dominfo.memory.max [VM memory, maximum]
libvirt.dominfo.memory.current [VM memory, current]
libvirt.dominfo.memory.boot [VM memory, at boot]
libvirt.dominfo.vcpu.max [VM vCPUs, maximum]
libvirt.dominfo.vcpu.current [VM vCPUs, current]
libvirt.dominfo.type [VM type]
libvirt.dominfo.os.type [VM OS type]
libvirt.dominfo.container [VM container]
libvirt.dominfo.description [VM description]
libvirt.dominfo.title [VM title]
libvirt.domstats.balloon.maximum [VM balloon size, maximum]
libvirt.domstats.balloon.current [VM balloon size, current]
libvirt.domstats.cpu.system [VM CPU time, system]
libvirt.domstats.cpu.time [VM CPU time, total]
libvirt.domstats.cpu.user [VM CPU time, user]
libvirt.domstats.perf.mbml [VM perf stats, mbml]
libvirt.domstats.perf.mbmt [VM perf stats, mbmt]
libvirt.domstats.perf.cmt [VM perf stats, cmt]
libvirt.domstats.mem.unused [VM memory, unused]
libvirt.domstats.mem.minor_fault [VM memory, minor faults]
libvirt.domstats.mem.rss [VM memory, proc RSS]
libvirt.domstats.mem.major_fault [VM memory, major faults]
libvirt.domstats.mem.actual [VM memory, balloon size]
libvirt.domstats.mem.swap_out [VM memory, swapped out]
libvirt.domstats.mem.swap_in [VM memory, swapped in]
libvirt.domstats.mem.available [VM memory, available]
libvirt.domstats.net.count [VM NICs, count]
libvirt.domstats.net.rx.bytes [VM NICs, rx bytes]
libvirt.domstats.net.rx.errs [VM NICs, rx errs]
libvirt.domstats.net.rx.drop [VM NICs, rx drop]
libvirt.domstats.net.rx.pkts [VM NICs, rx pkts]
libvirt.domstats.net.tx.bytes [VM NICs, tx bytes]
libvirt.domstats.net.tx.drop [VM NICs, tx drop]
libvirt.domstats.net.tx.errs [VM NICs, tx errs]
libvirt.domstats.net.tx.pkts [VM NICs, tx pkts]
libvirt.domstats.vcpu.current [VM vCPUs, current]
libvirt.domstats.vcpu.wait [VM vCPUs, wait]
libvirt.domstats.vcpu.time [VM vCPUs, time]
libvirt.domstats.vcpu.maximum [VM vCPUs, maximum]
libvirt.domstats.block.capacity [VM backing imgs, capacity]
libvirt.domstats.block.count [VM block devs, count]
libvirt.domstats.block.allocation [VM backing imgs, allocation]
libvirt.domstats.block.wr.times [VM block devs, wr times]
libvirt.domstats.block.wr.bytes [VM block devs, wr bytes]
libvirt.domstats.block.wr.reqs [VM block devs, wr reqs]
libvirt.domstats.block.fl.reqs [VM block devs, fl reqs]
libvirt.domstats.block.fl.times [VM block devs, fl times]
libvirt.domstats.block.rd.reqs [VM block devs, rd reqs]
libvirt.domstats.block.rd.times [VM block devs, rd times]
libvirt.domstats.block.rd.bytes [VM block devs, rd bytes]
libvirt.domstats.block.physical [VM backing imgs, physical]
libvirt.hv.secrets [Libvirt secrets]
libvirt.hv.nwfilters [Libvirt nw filters]
libvirt.hv.interfaces.inactive [Libvirt interfaces, inactive]
libvirt.hv.interfaces.active [Libvirt interfaces, active]
libvirt.hv.networks.inactive [Libvirt networks, inactive]
libvirt.hv.networks.active [Libvirt networks, active]
libvirt.hv.storagepools.inactive [Libvirt storage pools, inactive]
libvirt.hv.storagepools.active [Libvirt storage pools, active]
libvirt.hv.devices [Libvirt devices]
libvirt.hv.domains.inactive [Libvirt domains, inactive]
libvirt.hv.domains.active [Libvirt domains, active]
libvirt.hv.version [Libvirt version]
libvirt.hv.driver [Libvirt driver]
libvirt.hv.uri [Libvirt URI]
$

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>