Performance data is empty when giving startTime and endTime
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
Hi I tried to get host performance data. I tried the following code:
counterInfo = {}
for c in perfManager.perfCounter:
#print(c)
#time.sleep(500)
prefix = c.groupInfo.key
fullName = c.groupInfo.key + "."+c.nameInfo.key + "." + c.rollupType
#print(c.groupInfo.key, ' ',c.nameInfo.key,' ',c.rollupType, ' ',c.unitInfo.key)
counterInfo[fullName] = c.key
for child in content.rootFolder.childEntity:
datacenter = child
hostFolder = datacenter.hostFolder
hostList = hostFolder.childEntity
for hosts in hostList:
esxhosts = hosts.host
for esx in esxhosts:
summary = esx.summary
esxname = summary.config.name
counterIDs = [m.counterId for m in perfManager.QueryAvailablePerfMetric(entity=esx)]
metricIDs = [vim.PerformanceManager.MetricId(counterId=c, instance="*") for c in counterIDs]
spec = vim.PerformanceManager.QuerySpec(maxSample=1, entity=esx,intervalId=20,startTime=startTime, endTime=endTime, metricId=metricIDs)
result = perfManager.QueryStats(querySpec=[spec])
print(result)
But I got empty result.
Again If I remove startTime and endTime from the QuerySpec then I am getting some value. Can someone please explain why this is happening?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the QuerySpec and QueryStats usage shown in the issue, then review how pyVmomi represents startTime, endTime, intervalId, and available performance metrics. Reproduce the query with and without the time bounds and inspect the returned result. Done means the reason for the empty time-bounded result is documented and the issue identifies the required query conditions or correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100