vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.21k stars 764 forks source link

pyvmomi 7.0 to call the vCenter 6.7U3,the return value collected from ESXi performance was "-1" #979

Open gsoniya opened 2 years ago

gsoniya commented 2 years ago

Describe the bug

Cu use pyvmomi 7.0 to call the vCenter 6.7U3 for ESXi host's performance data.

But sometimes,the return value was "-1". It's not a reasonable value.

--The question were:

1.What's mean with the return value "-1" ?

Was it a special flag ?

2.What's the possible reason for the the return value "-1" ?

--The code as follow:

from pyVim.connect import SmartConnectNoSSL

from pyVmomi import vim

si = SmartConnectNoSSL(host="xxx",user="xxx",pwd="xxx",port=443)

content = si.RetrieveContent()

list of performance counter we want

perf_list = ["net.usage.average","datastore.read.average"]

Here to collect performance data

some code was ignored.At last the value in "perf_list" was put into "spec".

spec = vim.PerformanceManager.QuerySpec(maxSample=1,entity="xxx",metricId="xxxx",intervalId=20)

specs.append(spec)

results = content.perManager.QueryPerf(querySpec=specs)

for entity in results:

print(entity.value) #Sometimes,the output was "-1".

--

Reproduction steps

--The code as follow:

from pyVim.connect import SmartConnectNoSSL

from pyVmomi import vim

si = SmartConnectNoSSL(host="xxx",user="xxx",pwd="xxx",port=443)

content = si.RetrieveContent()

#list of performance counter

perf_list = ["net.usage.average","datastore.read.average"] 

#Here to collect performance data

#some code was ignored.At last the value in "perf_list" was put into "spec".

spec = vim.PerformanceManager.QuerySpec(maxSample=1,entity="xxx",metricId="xxxx",intervalId=20)

specs.append(spec)

results = content.perManager.QueryPerf(querySpec=specs)

for entity in results:

   print(entity.value)

Expected behavior

Cu use pyvmomi 7.0 to call the vCenter 6.7U3 for ESXi host's performance data.

Additional context

No response