[openstack-dev] [telemetry][ceilometer]Cannot get vmware virtual machine's disk usage rate via vsphere inspector

Along Meng alongmeng at gmail.com
Wed Jun 28 14:34:44 UTC 2017


HI, all
Today I try to add a new pollster plugin in ceilometer-agent-compute to
collect vmware virtual machines's disk usage rate.

After researched the vmware docs:
https://www.vmware.com/support/developer/converter-
sdk/conv61_apireference/disk_counters.html#usage

I think I can call the vsphere inspector get the counter capacity.provisioned
and capacity.usage.
Then I can get the virtual machine's disk usage rate via: disk_util =
capacity.usage/capacity.provisioned

*But, when I add a new function in vsphere inspector like below, It cannot
get any data from vcenter:*
My example code like this:

ceilometer.compute.virt.vmware.inspector.VsphereInspector#inspect_disks
=========================================================================
def inspect_disks(self, instance, duration=None):
    vm_moid = self._ops.get_vm_moid(instance.id)
    if not vm_moid:
        raise virt_inspector.InstanceNotFoundException(
            _('VM %s not found in VMware vSphere') % instance.id)

    VC_DISK_PROVISIONED_CNTR = "disk:capacity.provisioned:average"
    disk_counter_id = self._ops.get_perf_counter_id(VC_DISK_PROVISIONED_CNTR
)
    disk_infos = self._ops.query_vm_aggregate_stats(vm_moid,
mem_counter_id, duration)
    print “The disk info is:%s” % disk_infos
============================================================================

The disk_infos is empty.

I try to use these functions to query the counter value:
self._ops.query_vm_device_stats(vm_moid, disk_counter_id, duration)
self._ops.query_vm_aggregate_stats(vm_moid, mem_counter_id, duration)

*But cannot get any data from vcenter, and I'm sure the vcenter service is
correct in my env.*

*Does anyone know what's wrong with my code? *
*Or is there any other solutions for my requirement.*

Thanks~

==
MengAlong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170628/1dcc8173/attachment.html>


More information about the OpenStack-dev mailing list