Search code examples
githubdiagnosticsopenstack-novadevstack

nova diagnostics in devstack development


In ssh, when I run this command

nova diagnostics 2ad0dda0-072d-46c4-8689-3c487a452248

I got all the resources in devstack

+---------------------------+----------------------+
| Property                  | Value                |
+---------------------------+----------------------+
| cpu0_time                 | 3766640000000        |
| hdd_errors                | 18446744073709551615 |
| hdd_read                  | 111736               |
| hdd_read_req              | 73                   |
| hdd_write                 | 0                    |
| hdd_write_req             | 0                    |
| memory                    | 2097152              |
| memory-actual             | 2097152              |
| memory-available          | 1922544              |
| memory-major_fault        | 2710                 |
| memory-minor_fault        | 10061504             |
| memory-rss                | 509392               |
| memory-swap_in            | 0                    |
| memory-swap_out           | 0                    |
| memory-unused             | 1079468              |
| tap5a148e0f-b8_rx         | 959777               |
| tap5a148e0f-b8_rx_drop    | 0                    |
| tap5a148e0f-b8_rx_errors  | 0                    |
| tap5a148e0f-b8_rx_packets | 8758                 |
| tap5a148e0f-b8_tx         | 48872                |
| tap5a148e0f-b8_tx_drop    | 0                    |
| tap5a148e0f-b8_tx_errors  | 0                    |
| tap5a148e0f-b8_tx_packets | 615                  |
| vda_errors                | 18446744073709551615 |
| vda_read                  | 597230592            |
| vda_read_req              | 31443                |
| vda_write                 | 164690944            |
| vda_write_req             | 18422                |
+---------------------------+----------------------+

How can I get this in devstack user interfaces.

Please help..

Thanks in advance


Solution

  • its not available in openstack icehouse/juno version though it can be edited in juno to retrieve in devstack.

    I didn't use openstack Kilo. In juno, if your hypervisor is libvirt, Vsphere or XenAPI then you can retrive this statistics in devstack UI. for this you have to do this:

    For Libvirt In this location ceilometer/compute/virt/libvirt/inspector.py, add this:

    from oslo.utils import units
    from ceilometer.compute.pollsters import util
    
    
      def inspect_memory_usage(self, instance, duration=None):  
            instance_name = util.instance_name(instance)    
            domain = self._lookup_by_name(instance_name)    
            state = domain.info()[0]    
            if state == libvirt.VIR_DOMAIN_SHUTOFF: 
                LOG.warn(_('Failed to inspect memory usage of %(instance_name)s, '  
                           'domain is in state of SHUTOFF'),    
                         {'instance_name': instance_name})  
                return  
            try:    
                memory_stats = domain.memoryStats() 
                if (memory_stats and    
                        memory_stats.get('available') and   
                        memory_stats.get('unused')):    
                    memory_used = (memory_stats.get('available') -  
                                   memory_stats.get('unused'))  
                    # Stat provided from libvirt is in KB, converting it to MB.     
                    memory_used = memory_used / units.Ki    
                    return virt_inspector.MemoryUsageStats(usage=memory_used)   
                else:   
                    LOG.warn(_('Failed to inspect memory usage of ' 
                               '%(instance_name)s, can not get info from libvirt'), 
                             {'instance_name': instance_name})  
            # memoryStats might launch an exception if the method   
            # is not supported by the underlying hypervisor being   
            # used by libvirt   
            except libvirt.libvirtError as e:   
                LOG.warn(_('Failed to inspect memory usage of %(instance_name)s, '  
                           'can not get info from libvirt: %(error)s'), 
                                     {'instance_name': instance_name, 'error': e}) 
    

    for more details you can check the following link:

    https://review.openstack.org/#/c/90498/