<div dir="ltr"><div class="gmail-nH" style="color:rgb(0,0,0)"><div class="gmail-nH"><div class="gmail-ha"><h2 id="gmail-:11e" class="gmail-hP" tabindex="-1"><span style="font-weight:normal"><font size="2">HI, all</font></span></h2></div></div></div><div class="gmail-nH gmail-aHU" style="color:rgb(0,0,0);font-size:medium"><div class="gmail-nH gmail-hx"><div class="gmail-nH"><div class="gmail-h7 gmail-ie gmail-nH gmail-oy8Mbf gmail-Jux0I gmail-j23lnd" tabindex="-1"><div class="gmail-Bk" style="width:957px"><div class="gmail-G3 gmail-G2"><div id="gmail-:189"><div class="gmail-adn gmail-ads"><div class="gmail-gs"><div id="gmail-:18o" class="gmail-ii gmail-gt gmail-adP gmail-adO" style="font-size:12.8px"><div id="gmail-:111" class="gmail-a3s gmail-aXjCH gmail-m15ce9b7faac8f9ae"><div dir="ltr"><div>Today I try to add a new pollster plugin in ceilometer-agent-compute to collect vmware virtual machines's disk usage rate.</div><div><br></div><div>After researched the vmware docs: </div><div><a href="https://www.vmware.com/support/developer/converter-sdk/conv61_apireference/disk_counters.html#usage" target="_blank">https://www.vmware.com/<wbr>support/developer/converter-<wbr>sdk/conv61_apireference/disk_<wbr>counters.html#usage</a><br></div><div><br></div><div>I think I can call the vsphere inspector get the counter <span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">capacity.provisioned and </span><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">capacity.usage.</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">Then I can get the virtual machine's disk usage rate via: disk_util = </span><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">capacity.usage/</span><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">capacity.<wbr>provisioned</span><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px"> </span></div><div><br></div><div><b><font color="#ff0000">But, when I add a new function in vsphere inspector like below, It cannot get any data from vcenter:</font></b></div><div>My example code like this:</div><div><br></div><div>ceilometer.compute.virt.<wbr>vmware.inspector.<wbr>VsphereInspector#inspect_disks<br></div><div>==============================<wbr>==============================<wbr>=============</div><div><span style="color:rgb(0,0,128);font-weight:bold">def</span> inspect_disks(self, instance, duration=None):<br>    vm_moid = self._ops.get_vm_moid(<a href="http://instance.id/" target="_blank">instance<wbr>.id</a>)<br>    <span style="color:rgb(0,0,128);font-weight:bold">if not</span> vm_moid:<br>        <span style="color:rgb(0,0,128);font-weight:bold">raise</span> virt_inspector.<wbr>InstanceNotFoundException(<br>            _(<span style="color:rgb(0,128,0);font-weight:bold">'VM %s not found in VMware vSphere'</span>) % <a href="http://instance.id/" target="_blank">instance.id</a>)<br><br>    VC_DISK_PROVISIONED_CNTR = "disk:<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px">capacity.provisioned:<wbr>average"</span>   <br>    disk_counter_id = self._ops.get_perf_counter_id(<font style="font-family:Menlo;font-size:12px;background-color:rgb(251,250,248)"><wbr>VC_DISK_PROVISIONED_CNTR</font>)<br>    disk_infos = self._ops.<span style="font-size:9pt">query_vm_aggregate_<wbr>stats(</span><span style="font-size:9pt">vm_moid, mem_counter_id, duration)</span><span style="font-size:9pt"><br></span>    print “The disk info is:%s” % disk_infos<br></div><div>==============================<wbr>==============================<wbr>================</div><div><br></div><div>The disk_infos is empty.</div><div><br></div><div>I try to use these functions to query the counter value:</div><div><span style="color:rgb(148,85,141)">self</span>._ops.query_vm_device_<wbr>stats(vm_moid, disk_counter_id, duration)<br></div><div>self._ops.<span style="font-size:9pt">query_vm_aggregate_<wbr>stats(</span><span style="font-size:9pt">vm_moid, mem_counter_id, duration)</span><br></div><div><span style="font-size:9pt"><br></span></div><div><span style="font-size:9pt"><b><font color="#ff0000">But cannot get any data from vcenter, and I'm sure the vcenter service is correct in my env.</font></b></span></div><div><br></div><div><font color="#ff0000"><b>Does anyone know what's wrong with my code? </b></font></div><div><font color="#ff0000"><b>Or is there any other solutions for my requirement.</b></font></div><div><br></div><div>Thanks~</div><div><br></div><div>==</div><div>MengAlong</div></div></div></div></div></div></div></div></div></div></div></div></div></div>