VMware {code} Community
ucxmyron
Contributor
Contributor

vSphere API Performance Counters

I am working on some Java code to read performance metrics from VMs via the vSphere SDK.

I am getting the following performance counters:

cpu.usage.average
cpu.usagemhz.average
mem.consumed.average
disk.read.average
disk.write.average
net.received.average
net.transmitted.average


I build a PerfQuerySpec to indicate my range of time, format and interval I want to get my counters back that I submit to vimPort.queryPerf().


For each one of the PerfMetricId that I specify I want to get back, I notice that I can end up getting more than once instance of a performance counter for disk.read.average or net.received.average if I keep the instance blank for my PerfMetricId vs an asterisk.


For example:

The following will get me one instance for disk.read.average:

PerfMetricId metricId = new PerfMetricId();

metricId.setCounterId(KEY FOR disk.read.average;

metricId.setInstance("");

Following will get me 2 instances with identical values:

The following will get me one instance for disk.read.average:

PerfMetricId metricId = new PerfMetricId();

metricId.setCounterId(KEY FOR disk.read.average;

metricId.setInstance("*");

Is there a reason why there are so many instances for one disk or why I might want to get all of the instances vs just getting one?

Thanks

0 Kudos
0 Replies