VMware {code} Community
workvmware
Contributor
Contributor
Jump to solution

no performance data for host

*

Hello, I am retrieving the performance data from the VC Server and when I get the list of perfQuerySpec, I get 10 managed entities, 2 hosts and 8 VMs as we have set up in our VC server. Then when I pass in perfQuerySpec objects in queryPerf() method to retrieve performance metrics, my host managed entity magically disappears after queryPerf() is executed (i.e. when I get the values[] of type PerfEntityMetricBase, please see code below). It has only managed entities of mor type VirtualMachine, but not HostSystem. The hosts that are configured in the VC server are ESX 4.0. It works fine with VC server that has ESX 3.0. Could you please let me know what the problem is?

Please see below for code snippet.

Thank you.

Sushant

======================================

for (int i = 0; i < mor_hosts.size(); i++) {

*

ManagedObjectReference mor_host = mor_hosts.get(i);

ManagedEntity me_host = getMeHosts();

PerfProviderSummary pps_hosts = pm.queryPerfProviderSummary(me_host);

int refreshRate_hosts = pps_hosts.getRefreshRate();

PerfMetricId[] metricId_hosts = pm.queryAvailablePerfMetric(me_host, _calendarPerfStart, calendarPerfEnd, refreshRatehosts);

PerfQuerySpec qSpec_hosts = new PerfQuerySpec();

qSpec_hosts.setEntity(mor_host);

qSpec_hosts.setStartTime(_calendarPerfStart);

qSpec_hosts.setEndTime(_calendarPerfEnd);

qSpec_hosts.setMetricId(metricId_hosts);

qSpec_hosts.setIntervalId(refreshRate_hosts);

qSpec_hosts.setFormat("csv");

perfQuerySpec[counter] = qSpec_hosts;

++ counter;

ArrayList<ManagedObjectReference> mor_vms = vmu.getVirtualMachineMORs(inventoryCurrent, mor_host);

for (int j = 0; j < mor_vms.size(); j++) {

ManagedObjectReference mor_vm = mor_vms.get(j);

ManagedEntity me_vms = getMeVms();

PerfProviderSummary pps_vms = pm.queryPerfProviderSummary(me_vms);

int refreshRate_vms = pps_vms.getRefreshRate();

PerfMetricId[] metricId_vms = pm.queryAvailablePerfMetric(me_vms, _calendarPerfStart, calendarPerfEnd, refreshRatevms);

PerfQuerySpec qSpec_vms = new PerfQuerySpec();

qSpec_vms.setEntity(mor_vm);

qSpec_vms.setStartTime(_calendarPerfStart);

qSpec_vms.setEndTime(_calendarPerfEnd);

qSpec_vms.setMetricId(metricId_vms);

qSpec_vms.setIntervalId(refreshRate_vms);

qSpec_vms.setFormat("csv");

perfQuerySpec[counter] = qSpec_vms;

++ counter;

}

}

PerfEntityMetricBase[] values = null;

values = pm.queryPerf(perfQuerySpec);

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Hi,

It is a known issue that queryperf does not return data when queried against vCenter Server.

You can refer to the workaround provided for this. Please see the below KB article for the same:

http://kb.vmware.com/kb/1014091

Hope it helps.

View solution in original post

Reply
0 Kudos
6 Replies
storm27
Enthusiast
Enthusiast
Jump to solution

Hi,

We have not encountered any problem while retreiving the performnace data for an ESX 4.0 host being managed by 4.0 VC. Can you please check whether you are able to see the stats for this Host in the VI Client Performance tab or not. Also, can you attach your code so that we can recreate the issue at our end.

Reply
0 Kudos
workvmware
Contributor
Contributor
Jump to solution

Hello, thanks for your reply. I just wrote a small sample code and attached it here to test if this will work by connecting vSphere 4.0, but unfortunately the managed entity for host returns null in line# 87 for perfEntity if I connect to the VC. You can run and see if you can replicate the problem. As I mentioned before, this code works fine for ESX 4.0 if I connect directly and not through VC. Please let me know if this works for you. I could actually see data in VI Client though, but does not seem like queryPerf() method works as we expect. Just in case, we have ESX 4.0.0 build-164009 and VC Server 4.0.0 build- 162856.

Thank you

Sushant Dhakal

Reply
0 Kudos
uslacker99
Expert
Expert
Jump to solution

I have a sneaky suspicion that there's something wrong with the the configuration of the hosts. Can you confirm that all of the times are in sync with each other? Do you see the performance data from the VI Client? Does this work if you connect directly to ESX?

If the answer is yes to all of the above questions, please export diagnostic data from the VC and upload that.

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi,

It is a known issue that queryperf does not return data when queried against vCenter Server.

You can refer to the workaround provided for this. Please see the below KB article for the same:

http://kb.vmware.com/kb/1014091

Hope it helps.

Reply
0 Kudos
workvmware
Contributor
Contributor
Jump to solution

Thanks for your reply. Yes, it turns out that this is a vmware issue that has not been resolved yet. May be we will see some patch that could potentially solve the problem.

Thank you

Sushant

Reply
0 Kudos
cruiser_csuf
Contributor
Contributor
Jump to solution

Do the KB says we can connect directly to the ESX host and it will work. How do you do that?

Reply
0 Kudos