VMware {code} Community
raghuamilineni
Contributor
Contributor

Peformance metrics of CPU utilization

Hi,

I am trying to obtain performance metrics of CPU. The client application i develop connects a dell power edge where ESX server is installed.

Server is configured with 2 Quad core processors.

I am trying to fetch metrics for cpu.usage.average counter.

When i am trying to obtain data , i get a lot of samples for each CPU instance.

I totally get 8 CPU instances ranging from 0 - 7 for a single CPU counter.

each instance displays around 400 values(even after setting maxsample property of perfqueryspec dataobject to 1)

I need only cpu usage average of each instance. I am attaching the code here. Please correct my code to display the cpu average for each instance.

Thanks in Advance

ARD

Tags (1)
0 Kudos
2 Replies
daniellynn
Enthusiast
Enthusiast

What time span are you looking for the average for?

Your interval is 20, which is in seconds. From what I saw, what you'd get is the average cpu usage each 20 seconds for the past hour (20 seconds * 180 samples). It's been a while since I messed with this, but the intervals I use regularly are 300, which is 5 minutes, 7200, which is 2 hours, and 86400, which is a day. You probably also track 1800, which is 30 minutes. You can go into vCenter Server Settings and look under "Statistics" to see what you're tracking. All will have the "average" rollup, but you'll have to have a higher logging setting on them for things like min and max. Other than that, just change your maxsample to 1. For example, for a "now" statistic, I use intervalId 20 and maxsample of 1 and that gives me the average of the metric in the last 20 seconds.

Hope that helps - it looks like it should be an easy last step.

0 Kudos
raghuamilineni
Contributor
Contributor

Thanks for the reply Mr.Daniellynn

I have even tried setting intervelid as 300, still i get more number of samples. and moreover i am not connected to a vCenter machine,

I am directly connecting to a ESX machine. The values what I get are normal integer values for each sample, but the average dsplayed

by vi client is in decimal format(2.5). is there any calculation to de done after getting the samples?.

But write now in the code,i am displaying the last sample for each counter.

As it is given in API documentation 20 sec is refresh rate of the performance provider. so i had to set it to 20.

any idea how to get the metric in percentage (like 2.5) instead of decimal format.

Thanks in Advance

ARD

0 Kudos