VMware {code} Community
tqll
Contributor
Contributor

How can I get storage utilization counters value from a virtual center?

I need get storage utilization counters value from a virtual center.

Since these counters populated every 30 min, I use 60*30 as the last parameter of method queryAvailablePerfMetric, intervalId. Once I call queryAvailablePerfMetric, I got the following error messages.

09/29/2009 12:45:26 PM ERROR (agent.collects.VmWareCollect:346) - instance9

com.vmware.vim25.SystemError

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at java.lang.Class.newInstance0(Class.java:355)

at java.lang.Class.newInstance(Class.java:308)

at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:210)

at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:86)

at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:128)

at com.vmware.vim25.ws.VimStub.queryAvailablePerfMetric(VimStub.java:1122)

at com.vmware.vim25.mo.PerformanceManager.queryAvailablePerfMetric(PerformanceManager.java:83)

at com.teamquest.agent.collects.VmWareCollect.getPerformanceObjects(VmWareCollect.java:1860)

at com.teamquest.agent.collects.VmWareCollect.isInterval(VmWareCollect.java:211)

at com.teamquest.agent.collects.VmWareCollect.requestCollect(VmWareCollect.java:245)

at com.teamquest.agent.collects.BaseCollect.run(BaseCollect.java:76)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Error.reasons is not initialized.

pm of the following code is a PerformanceManager

Below is my code.

_calendarDSEnd = _calendarHost;

calendarDSStart = (Calendar)calendarDSEnd.clone();

_calendarDSStart.add(Calendar.SECOND, - 60*30);

PerfMetricId[] metricId_datastores = pm.queryAvailablePerfMetric(me_ds[d], _calendarPerfStart, _calendarPerfEnd, 60*30);

Thank you

Reply
0 Kudos
2 Replies
storm27
Enthusiast
Enthusiast

Hi,

I believe that you are calling the API in an incorrect way. Instead it should be:

PerfMetricId[] ids = _service.queryAvailablePerfMetric(perfRef, morRef, null, null, new Integer(60*30));

where:

- _service - is the object of the VimPortType which is a Vim interface,through which every API is called.

- perfRef - is the managedobjectreference for the performance namager

- morRef - is the managed object of which you are trying to retreive the performance counters

instead of the two null values, you can explicitly pass the start and end time (the way you have specified in your code)

For further clarifications, please refer to samples shipped with the vSphere SDK package.

Reply
0 Kudos
tqll
Contributor
Contributor

Hi

I tried the API

PerfMetricId[] ids = vimPort.queryAvailablePerfMetric(mor_pm,

mor_ds,_calendarPerfStart, _calendarPerfEnd, new Integer(60*30));

Where:

vimPort =

(VimPortType)_mm.getConVmware().getServerConnection().getVimService();

mor_pm is a managedobjectreference for the performance namager

mor_ds is a managedobjectreference for the Datastore.

But I get same error as before.

com.vmware.vim25.SystemError

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native

Method)

at

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA

ccessorImpl.java:39)

at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons

tructorAccessorImpl.java:27)

at

java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at java.lang.Class.newInstance0(Class.java:355)

at java.lang.Class.newInstance(Class.java:308)

at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:210)

at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:86)

at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:128)

at

com.vmware.vim25.ws.VimStub.queryAvailablePerfMetric(VimStub.java:1122)

at

com.teamquest.agent.collects.VmWareCollect.getPerformanceObjects(VmWareC

ollect.java:1866)

at

com.teamquest.agent.collects.VmWareCollect.isInterval(VmWareCollect.java

:213)

at

com.teamquest.agent.collects.VmWareCollect.requestCollect(VmWareCollect.

java:247)

at

com.teamquest.agent.collects.BaseCollect.run(BaseCollect.java:76)

at

java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at

java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at

java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.acc

ess$301(ScheduledThreadPoolExecutor.java:98)

at

java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run

(ScheduledThreadPoolExecutor.java:207)

at

java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto

r.java:886)

at

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja

va:908)

at java.lang.Thread.run(Thread.java:619)

(SystemError and reason - Not initialized)

Thank you

Reply
0 Kudos