pcp
[Top] [All Lists]

Re: [pcp] PCP libvirt PMDA

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] PCP libvirt PMDA
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Fri, 22 Jul 2016 02:06:13 +0300
Cc: pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <810341356.7539206.1469047436415.JavaMail.zimbra@xxxxxxxxxx>
Organization: Red Hat
References: <1fa58d82-ac73-7747-c58d-acf880bc2155@xxxxxxxxxx> <20ae899d-50c6-1457-644f-f45ad26c63d4@xxxxxxxxxx> <37250089.6949181.1468900166388.JavaMail.zimbra@xxxxxxxxxx> <fc9e92aa-355e-6cc1-7586-599847cf6cbe@xxxxxxxxxx> <1473242169.7374530.1468971331935.JavaMail.zimbra@xxxxxxxxxx> <810341356.7539206.1469047436415.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2
Hi,

On 2016-07-20 23:43, Nathan Scott wrote:
> ----- Original Message -----
>>> [...]
>>> What kind of "highly problematic" scenarios there has been in the past?
>>
>> So, one example is pmie - there is no equivalent of some_inst, etc for
>> metric names, so rules end up having to be expanded for every metric.
>> pmchart configs have similar issues, regex matching on instance names
>> is available but metric names are expected to be more static (and need
>> individual expansion in the configuration files).
>>
>> Another class of problems is around naming - metric names are defined
>> to be less flexible than instance names (as per that pmns(5) extract,
>> from earlier).
> 
> I forgot another biggie yesterday - related to the persistence of PMIDs.
> Its important to a number of the client tools (pmlogger, pmie, pmchart,
> hmmm pretty much all actually) that if pmcd is restarted, metrics return
> with the same PMID as before (this is pretty much part of the protocol
> over-the-wire, and its also necessary on-disk between archives of the
> same host).
> 
> This becomes very difficult to ensure in the case of dynamic metrics -
> it was the main reason we switch cgroups to using this model IIRC.  And
> the pmdaCache interfaces support persisting instance identifiers well of
> course.
> 
> Also, along the vein of PMIDs, and especially depending on how the PMID
> "cluster" identifier is used, the size limits of 10 bits (1024 metrics)
> and/or 22 bits (if full cluster space available also) are less appealing
> than the convenience of the full 32 bit instance identifier space.

Ok, let's start first by renaming the current metric names to ...all...
which they really are, we can then add device specific metrics later
without changing any current metrics.

Patch below, don't get scared of its size, I kept the formatting
consistent so quite some whitespace-only changes.

---
 src/pmdas/libvirt/pmdalibvirt.python | 171 +++++++++++++++++++----------------
 1 file changed, 94 insertions(+), 77 deletions(-)

diff --git a/src/pmdas/libvirt/pmdalibvirt.python 
b/src/pmdas/libvirt/pmdalibvirt.python
index 06258ad..66449db 100755
--- a/src/pmdas/libvirt/pmdalibvirt.python
+++ b/src/pmdas/libvirt/pmdalibvirt.python
@@ -77,20 +77,20 @@ class LibvirtPMDA(PMDA):
         self.hv_metrics = [
             # Name - method - type - semantics - units - help
             # See libvirt.py
-            [ 'hv.uri',                    'getURI',                   
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'Libvirt URI'                     
],
-            [ 'hv.driver',                 'getType',                  
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'Libvirt driver'                  
],
-            [ 'hv.version',                'getVersion',               
PM_TYPE_U32,    PM_SEM_DISCRETE, units_none,  'Libvirt version'                 
],
-            [ 'hv.domains.active',         'numOfDomains',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt domains, active'         
],
-            [ 'hv.domains.inactive',       'numOfDefinedDomains',      
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt domains, inactive'       
],
-            [ 'hv.devices',                'numOfDevices',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt devices'                 
],
-            [ 'hv.storagepools.active',    'numOfStoragePools',        
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt storage pools, active'   
],
-            [ 'hv.storagepools.inactive',  'numOfDefinedStoragePools', 
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt storage pools, inactive' 
],
-            [ 'hv.networks.active',        'numOfNetworks',            
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt networks, active'        
],
-            [ 'hv.networks.inactive',      'numOfDefinedNetworks',     
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt networks, inactive'      
],
-            [ 'hv.interfaces.active',      'numOfInterfaces',          
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt interfaces, active'      
],
-            [ 'hv.interfaces.inactive',    'numOfDefinedInterfaces',   
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt interfaces, inactive'    
],
-            [ 'hv.networkfilters',         'numOfNWFilters',           
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt network filters'         
],
-            [ 'hv.secrets',                'numOfSecrets',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt secrets'                 
],
+            [ 'hv.uri',                          'getURI',                   
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'Libvirt URI'                     
],
+            [ 'hv.driver',                       'getType',                  
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'Libvirt driver'                  
],
+            [ 'hv.version',                      'getVersion',               
PM_TYPE_U32,    PM_SEM_DISCRETE, units_none,  'Libvirt version'                 
],
+            [ 'hv.domains.active',               'numOfDomains',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt domains, active'         
],
+            [ 'hv.domains.inactive',             'numOfDefinedDomains',      
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt domains, inactive'       
],
+            [ 'hv.devices',                      'numOfDevices',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt devices'                 
],
+            [ 'hv.storagepools.active',          'numOfStoragePools',        
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt storage pools, active'   
],
+            [ 'hv.storagepools.inactive',        'numOfDefinedStoragePools', 
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt storage pools, inactive' 
],
+            [ 'hv.networks.active',              'numOfNetworks',            
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt networks, active'        
],
+            [ 'hv.networks.inactive',            'numOfDefinedNetworks',     
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt networks, inactive'      
],
+            [ 'hv.interfaces.active',            'numOfInterfaces',          
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt interfaces, active'      
],
+            [ 'hv.interfaces.inactive',          'numOfDefinedInterfaces',   
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt interfaces, inactive'    
],
+            [ 'hv.networkfilters',               'numOfNWFilters',           
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt network filters'         
],
+            [ 'hv.secrets',                      'numOfSecrets',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'Libvirt secrets'                 
],
         ]
 
         self.vm_indom = self.indom(0)
@@ -101,18 +101,18 @@ class LibvirtPMDA(PMDA):
         self.vm_metrics = [
             # Name - xpath - type - semantics - units - help
             # See https://libvirt.org/formatdomain.html
-            [ 'dominfo.type',              '/domain/@type',            
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM type'                         
],
-            [ 'dominfo.name',              '/domain/name',             
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM name'                         
],
-            [ 'dominfo.uuid',              '/domain/uuid',             
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM UUID'                         
],
-            [ 'dominfo.title',             '/domain/title',            
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM title'                        
],
-            [ 'dominfo.description',       '/domain/description',      
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM description'                  
],
-            [ 'dominfo.container',         '/domain/os/init',          
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM container'                    
],
-            [ 'dominfo.os.type',           '/domain/os/type',          
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM OS type'                      
],
-            [ 'dominfo.vcpu.current',      '/domain/vcpu/@current',    
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, current'               
],
-            [ 'dominfo.vcpu.max',          '/domain/vcpu',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, maximum'               
],
-            [ 'dominfo.memory.boot',       '/domain/memory',           
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, at boot'              
],
-            [ 'dominfo.memory.current',    '/domain/currentMemory',    
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, current'              
],
-            [ 'dominfo.memory.max',        '/domain/maxMemory',        
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, maximum'              
],
+            [ 'dominfo.type',                  '/domain/@type',            
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM type'                         
  ],
+            [ 'dominfo.name',                  '/domain/name',             
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM name'                         
  ],
+            [ 'dominfo.uuid',                  '/domain/uuid',             
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM UUID'                         
  ],
+            [ 'dominfo.title',                 '/domain/title',            
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM title'                        
  ],
+            [ 'dominfo.description',           '/domain/description',      
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM description'                  
  ],
+            [ 'dominfo.container',             '/domain/os/init',          
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM container'                    
  ],
+            [ 'dominfo.os.type',               '/domain/os/type',          
PM_TYPE_STRING, PM_SEM_DISCRETE, units_none,  'VM OS type'                      
  ],
+            [ 'dominfo.vcpu.current',          '/domain/vcpu/@current',    
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, current'               
  ],
+            [ 'dominfo.vcpu.max',              '/domain/vcpu',             
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, maximum'               
  ],
+            [ 'dominfo.memory.boot',           '/domain/memory',           
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, at boot'              
  ],
+            [ 'dominfo.memory.current',        '/domain/currentMemory',    
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, current'              
  ],
+            [ 'dominfo.memory.max',            '/domain/maxMemory',        
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, maximum'              
  ],
         ]
 
         self.vm_cpustats_res = []
@@ -120,9 +120,9 @@ class LibvirtPMDA(PMDA):
         self.vm_cpustats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.cpu.time',         None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, total'              
],
-            [ 'domstats.cpu.system',       None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, system'             
],
-            [ 'domstats.cpu.user',         None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, user'               
],
+            [ 'domstats.cpu.time',             None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, total'              
  ],
+            [ 'domstats.cpu.system',           None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, system'             
  ],
+            [ 'domstats.cpu.user',             None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM CPU time, user'               
  ],
         ]
 
         self.vm_vcpustats_res = []
@@ -130,11 +130,11 @@ class LibvirtPMDA(PMDA):
         self.vm_vcpustats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.vcpu.current',     None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, current'               
],
-            [ 'domstats.vcpu.maximum',     None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, maximum'               
],
-#           [ 'domstats.vcpu.state',       None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_none,  'VM vCPUs, state'                 
],
-            [ 'domstats.vcpu.time',        None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM vCPUs, time'                  
],
-            [ 'domstats.vcpu.wait',        None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM vCPUs, wait'                  
],
+            [ 'domstats.vcpu.current',         None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, current'               
  ],
+            [ 'domstats.vcpu.maximum',         None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM vCPUs, maximum'               
  ],
+            [ 'domstats.vcpu.all.state',       None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_none,  'VM vCPUs, total state'           
  ],
+            [ 'domstats.vcpu.all.time',        None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM vCPUs, total time'            
  ],
+            [ 'domstats.vcpu.all.wait',        None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM vCPUs, total wait'            
  ],
         ]
 
         self.vm_memstats_res = {}
@@ -142,14 +142,14 @@ class LibvirtPMDA(PMDA):
         self.vm_memstats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/include/libvirt/libvirt-domain.h
-            [ 'domstats.mem.swap_in',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_kbyte, 'VM memory, swapped in total'     
],
-            [ 'domstats.mem.swap_out',     None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_kbyte, 'VM memory, swapped out total'    
],
-            [ 'domstats.mem.major_fault',  None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM memory, major faults'         
],
-            [ 'domstats.mem.minor_fault',  None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM memory, minor faults'         
],
-            [ 'domstats.mem.unused',       None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, unused'               
],
-            [ 'domstats.mem.available',    None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, available'            
],
-            [ 'domstats.mem.actual',       None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, balloon size'         
],
-            [ 'domstats.mem.rss',          None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, proc RSS'             
],
+            [ 'domstats.mem.swap_in',          None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_kbyte, 'VM memory, swapped in total'     
  ],
+            [ 'domstats.mem.swap_out',         None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_kbyte, 'VM memory, swapped out total'    
  ],
+            [ 'domstats.mem.major_fault',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM memory, major faults'         
  ],
+            [ 'domstats.mem.minor_fault',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM memory, minor faults'         
  ],
+            [ 'domstats.mem.unused',           None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, unused'               
  ],
+            [ 'domstats.mem.available',        None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, available'            
  ],
+            [ 'domstats.mem.actual',           None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, balloon size'         
  ],
+            [ 'domstats.mem.rss',              None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM memory, proc RSS'             
  ],
         ]
 
         self.vm_balloonstats_res = []
@@ -157,8 +157,8 @@ class LibvirtPMDA(PMDA):
         self.vm_balloonstats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.balloon.current',  None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM balloon size, current'        
],
-            [ 'domstats.balloon.maximum',  None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM balloon size, maximum'        
],
+            [ 'domstats.balloon.current',      None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM balloon size, current'        
  ],
+            [ 'domstats.balloon.maximum',      None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_kbyte, 'VM balloon size, maximum'        
  ],
         ]
 
         self.vm_blockstats_res = []
@@ -166,18 +166,20 @@ class LibvirtPMDA(PMDA):
         self.vm_blockstats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.block.count',      None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM block devs, count'            
],
-            [ 'domstats.block.rd.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, rd reqs'          
],
-            [ 'domstats.block.rd.bytes',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM block devs, rd bytes'         
],
-            [ 'domstats.block.rd.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, rd times'         
],
-            [ 'domstats.block.wr.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, wr reqs'          
],
-            [ 'domstats.block.wr.bytes',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM block devs, wr bytes'         
],
-            [ 'domstats.block.wr.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, wr times'         
],
-            [ 'domstats.block.fl.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, fl reqs'          
],
-            [ 'domstats.block.fl.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, fl times'         
],
-            [ 'domstats.block.allocation', None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, allocation'     
],
-            [ 'domstats.block.capacity',   None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, capacity'       
],
-            [ 'domstats.block.physical',   None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, physical'       
],
+            [ 'domstats.block.count',          None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM block devs, count'            
  ],
+            [ 'domstats.block.all.rd.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, total rd reqs'    
  ],
+            [ 'domstats.block.all.rd.bytes',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM block devs, total rd bytes'   
  ],
+            [ 'domstats.block.all.rd.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, total rd times'   
  ],
+            [ 'domstats.block.all.wr.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, total wr reqs'    
  ],
+            [ 'domstats.block.all.wr.bytes',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM block devs, total wr bytes'   
  ],
+            [ 'domstats.block.all.wr.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, total wr times'   
  ],
+            [ 'domstats.block.all.fl.reqs',    None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM block devs, total fl reqs'    
  ],
+            [ 'domstats.block.all.fl.times',   None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_nsecs, 'VM block devs, total fl times'   
  ],
+            [ 'domstats.block.all.name',       None,                       
PM_TYPE_STRING, PM_SEM_INSTANT,  units_none,  'VM block devs, all names'        
  ],
+            [ 'domstats.block.all.allocation', None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, total 
allocation' ],
+            [ 'domstats.block.all.capacity',   None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, total capacity' 
  ],
+            [ 'domstats.block.all.physical',   None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM backing imgs, total physical' 
  ],
+            [ 'domstats.block.all.path',       None,                       
PM_TYPE_STRING, PM_SEM_INSTANT,  units_none,  'VM backing imgs, all paths'      
  ],
         ]
 
         self.vm_netstats_res = []
@@ -185,15 +187,16 @@ class LibvirtPMDA(PMDA):
         self.vm_netstats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.net.count',        None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM NICs, count'                  
],
-            [ 'domstats.net.rx.bytes',     None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM NICs, rx bytes'               
],
-            [ 'domstats.net.rx.pkts',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, rx pkts'                
],
-            [ 'domstats.net.rx.errs',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, rx errs'                
],
-            [ 'domstats.net.rx.drop',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, rx drop'                
],
-            [ 'domstats.net.tx.bytes',     None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM NICs, tx bytes'               
],
-            [ 'domstats.net.tx.pkts',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, tx pkts'                
],
-            [ 'domstats.net.tx.errs',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, tx errs'                
],
-            [ 'domstats.net.tx.drop',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, tx drop'                
],
+            [ 'domstats.net.count',            None,                       
PM_TYPE_U32,    PM_SEM_INSTANT,  units_count, 'VM NICs, count'                  
  ],
+            [ 'domstats.net.all.name',         None,                       
PM_TYPE_STRING, PM_SEM_INSTANT,  units_none,  'VM NICs, all names'              
  ],
+            [ 'domstats.net.all.rx.bytes',     None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM NICs, total rx bytes'         
  ],
+            [ 'domstats.net.all.rx.pkts',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total rx pkts'          
  ],
+            [ 'domstats.net.all.rx.errs',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total rx errs'          
  ],
+            [ 'domstats.net.all.rx.drop',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total rx drop'          
  ],
+            [ 'domstats.net.all.tx.bytes',     None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_bytes, 'VM NICs, total tx bytes'         
  ],
+            [ 'domstats.net.all.tx.pkts',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total tx pkts'          
  ],
+            [ 'domstats.net.all.tx.errs',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total tx errs'          
  ],
+            [ 'domstats.net.all.tx.drop',      None,                       
PM_TYPE_U64,    PM_SEM_COUNTER,  units_count, 'VM NICs, total tx drop'          
  ],
         ]
 
         self.vm_perfstats_res = []
@@ -201,9 +204,9 @@ class LibvirtPMDA(PMDA):
         self.vm_perfstats = [
             # Name - empty - type - semantics - units - help
             # See libvirt.git/src/libvirt-domain.c
-            [ 'domstats.perf.cmt',         None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM perf stats, cmt'              
],
-            [ 'domstats.perf.mbmt',        None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bpers, 'VM perf stats, mbmt'             
],
-            [ 'domstats.perf.mbml',        None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bpers, 'VM perf stats, mbml'             
],
+            [ 'domstats.perf.cmt',             None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bytes, 'VM perf stats, cmt'              
  ],
+            [ 'domstats.perf.mbmt',            None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bpers, 'VM perf stats, mbmt'             
  ],
+            [ 'domstats.perf.mbml',            None,                       
PM_TYPE_U64,    PM_SEM_INSTANT,  units_bpers, 'VM perf stats, mbml'             
  ],
         ]
 
         for item in range(len(self.hv_metrics)):
@@ -586,7 +589,7 @@ class LibvirtPMDA(PMDA):
 
         if cluster == self.vm_memstats_cluster:
             try:
-                key = self.vm_memstats[item][0].rsplit('.')[2]
+                key = self.vm_memstats[item][0].rpartition('.')[2]
                 return 
[self.vm_memstats_res[self.vm_insts.inst_name_lookup(inst)][key], 1]
             except:
                 return [PM_ERR_VALUE, 0]
@@ -627,21 +630,25 @@ class LibvirtPMDA(PMDA):
                 if pos < 0:
                     return [PM_ERR_INST, 0]
 
+                key = mtx[item][0].partition('.')[2]
+
                 # All done for non-dynamic clusters
                 if cluster != self.vm_vcpustats_cluster and \
                    cluster != self.vm_blockstats_cluster and \
                    cluster != self.vm_netstats_cluster:
-                    key = '.'.join(mtx[item][0].split('.')[1:])
                     if key in res[pos][1]:
                         return [res[pos][1][key], 1]
                     else:
                         return [PM_ERR_AGAIN, 0]
 
                 # Non-combined values in dynamic clusters
-                key = '.'.join(mtx[item][0].split('.')[1:])
                 if key == 'vcpu.current' or key == 'vcpu.maximum' or \
-                   key == 'net.count' or key == 'block.count':
-                    return [res[pos][1][key], 1]
+                   key == 'net.count' or key == 'block.count' or \
+                   '.all.' not in key:
+                    if key in res[pos][1]:
+                        return [res[pos][1][key], 1]
+                    else:
+                        return [PM_ERR_AGAIN, 0]
 
                 # Combine N values for dynamic metrics
                 if 'vcpu' in mtx[item][0]:
@@ -653,12 +660,22 @@ class LibvirtPMDA(PMDA):
                 else:
                     return [PM_ERR_VALUE, 0]
 
-                # Calculate the combined value
-                value = 0
+                # Construct the combined total value
+                mtype = mtx[item][2]
+                if mtype == PM_TYPE_STRING:
+                    value = ""
+                else:
+                    value = 0
                 for i in range(count):
-                    k = key.split('.')[0] + '.' + str(i) + '.' + 
'.'.join(key.split('.')[1:])
+                    parts = key.partition('.all.')
+                    k = parts[0] + '.' + str(i) + '.' + parts[2]
                     if k in res[pos][1]:
-                        value += res[pos][1][k]
+                        if mtype == PM_TYPE_STRING:
+                            value = value + ' ' + res[pos][1][k]
+                        else:
+                            value += res[pos][1][k]
+                if mtype == PM_TYPE_STRING and value.startswith(' '):
+                    value = value[1:]
                 return [value, 1]
             except:
                 return [PM_ERR_VALUE, 0]

Thanks,

-- 
Marko Myllynen

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