pyvmomi-community-samples
pyvmomi-community-samples copied to clipboard
refresh rate for Performance Manager
hi
I tried the "vm_perf_example.py" in the pyvmomi-community-samples, and it was okay, but there are two problems:
in some time periods it just returns an array of null just like below:
(vim.PerformanceManager.EntityMetricBase) [ (vim.PerformanceManager.EntityMetric) { dynamicType = <unset>, dynamicProperty = (vmodl.DynamicProperty) [], entity = 'vim.VirtualMachine:vm-2619', sampleInfo = (vim.PerformanceManager.SampleInfo) [], value = (vim.PerformanceManager.MetricSeries) [] } ]
and the other problem, it returns data in periods of 300s (5 minutes)! how can we set refresh rate to something like 30s
I found the refresh rate solution :
perfManager = self.si.RetrieveContent().perfManager
provider_summary = perfManager.QueryPerfProviderSummary(entity='''VM OR HOST''')
interval_id = provider_summary.refreshRate
metricId = vim.PerformanceManager.MetricId(counterId='''ID of wanted metric''', instance="")
startTime = datetime.datetime.now() - datetime.timedelta(hours='''Duration''')
query = vim.PerformanceManager.QuerySpec(entity='''VM OR HOST''', metricId=[metricId],intervalId=interval_id,startTime=startTime)
m = perfManager.QueryPerf(querySpec=[query])
But still, I could not found why some metrics for VM objects return null and mostly happen in memory and network metrics. Can anyone please help me to solve this issue too!
@hmadadian This could be due to the aggregate level vs per device level metrics that are categorized by the VMWare. Not all the real-time metrics (or historical metrics) are available for the objects by default. There are level 1-4 aggregate metrics in vCenter and only level 1 are avilable at real time with 20 seconds unless you change them.