VMware {code} Community
deepakmits
Contributor
Contributor

How can I get Perf stats for a resource pool or a cluster ?

I tried with this code :

In this code if I give 20 instead of 300 it gives some exception saying invalid parameter . and when I give 300 though I have set max sample size 1, I get a huge list of samples. Can somebody explain why does this returns huge list instead of returning 1 sample ? I am interested in getting only one most recent sample.

PerfMetricId[] aMetrics = clientInfo.getConnection().

getService().queryAvailablePerfMetric(pmRef, mor, StartTime, EndTime, new Integer(300));

if(aMetrics != null){

PerfQuerySpec qSpec = new PerfQuerySpec();

qSpec.setEntity(mor);

qSpec.setMaxSample(new Integer(1));

qSpec.setMetricId(aMetrics);

qSpec.setIntervalId(new Integer(300));

PerfQuerySpec[] qSpecs = new PerfQuerySpec[] {qSpec};

PerfEntityMetricBase[] pValues = clientInfo.getConnection().getService().queryPerf(pmRef,qSpecs)

Thanks !

0 Kudos
6 Replies
admin
Immortal
Immortal

The intervalID is not valid because validity is guaranteed when the intervalID is: o Equal to the refresh rate for a provider. o One of the intervals used previously, which is stored as historical information

The interval ID used in the PerfQuerySpec for QueryPerf, is the samplingPeriod in the structure historicalInterval(PerfInterval). IntervalIDs indicates the number of seconds for which the performance statistics are summarized.

For example, for an interval that summarizes statistics for five minute intervals, the interval ID is 300 (60x5). VC ships with following default interval ids:

name samplingPeriod length

Past Day 300 (5 minutes) 86400 (1 day)

Past Week 1800 (30 minutes) 604800 (1 week)

Past Month 7200 (2 hours) 2592000 (30 days)

Past Year 86400 (1 day) 31536000 (365 days)

The reason your code does not return a single sample, is probably because you are also specifiying a start time and end time. If the user specifies a maxSample of 1, but not a given time range, the most recent sample collected is returned.

I hope the above helps provide better understanding of performance stats.

deepakmits
Contributor
Contributor

Thanks for your reply.

Even after not specifying any time starttime and endtime and keeping max sample num as 1 and interval ID as 300, I am getting again huge list of samples for resource pools and clusters.

Any other thought for resolving this ?

And is it right to assume that for Resource Pool and Clusters refresh rate is 300secs or 5min. whereas for Host and VMs it is 20secs. ?

Thanks.

0 Kudos
njain
Expert
Expert

Hi,

The "maxSample" works only for the real-time data. This parameter is ignored when the data being queried is historical. Since intervalID specified is 300, which is a sampling period for historical data, you will not get 1 sample.

Regarding your assumption on refresh rate, it is incorrect. In order to get the refresh rate for an entity, you can use the "QueryPerfProviderSummary" API. This method returns the "PerfProviderSummary" data object which provides the information regarding the refresh rate for that entity.

Please note that this value applies only to entities that support real-time (current) statistics. Thus, if the "currentSupported" property is not true, the refresh rate for that entity does not exist. In this case, the real time statistics are not available for the entity.

Hope this information clarifies your doubts.

0 Kudos
deepakmits
Contributor
Contributor

Thanks for your reply.

Yes information given by you has really been helpful.

But I want to get the latest perf stats for resource pool or cluster. So how can I get the latest i.e. only one sample not a list for these? Is it possible or not ?

Or if I will have to get that latest from that huge list of samples which I get on using IntervalId as 300. How do I have to get that ?

Thanks !

0 Kudos
deepakmits
Contributor
Contributor

thanks!

0 Kudos
sbhor
Contributor
Contributor

Hi,

I am also facing the same problem while collecting the performance data for resource pool and cluster.We are getting the 3 values for each counter instaed of 1 samle. As refresh rate property is not present for resource pool and cluster entity we have specified the interval ID as 300 sec .

Is there any way to get the latest 1 sample of performance data for the resource pool and cluster entity.

Thanks

0 Kudos