VMware {code} Community
sbouchex
Enthusiast
Enthusiast

Calling queryAvailablePerfMetric on a datastore

Hello,

I'm trying to list the available counters on a datastore and the call is failing with an axis fault : "A general system error occurred: optional value not set"

I'm simply doing : PerfMetricId[] aMetrics = _service.queryAvailablePerfMetric(pmRef, dsRef, null, null, 86400);

Where dsRef is my datastore

Note that if I do a queryPerf with a metricId on a datastore entity, I'm getting the same exception.

Thanks

Seb

Reply
0 Kudos
4 Replies
Steve_Jin
Expert
Expert

Hi Seb,

You may want to try with HostSystem object for the metric. For more detail, check out the thread on open source vijava API forum here:

http://sourceforge.net/projects/vijava/forums/forum/826592/topic/3851050

Also, summarized content at my blog: http://www.doublecloud.org/2010/10/a-workaround-to-identify-nfs-based-datastore-in-vsphere/

Good luck!



Steve JIN

Author of VMware VI and vSphere SDK (Prentice Hall)

Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)

Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)

Twitter: @sjin2008

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
Reply
0 Kudos
sbouchex
Enthusiast
Enthusiast

Hi,

Yes, but according to the VMware SDK documentation, the datastore counters can be accessed without beeing attached to a particular VM.

The choice is done by specify either the datastore or the VM managed object in queryAvailablePerformanceCounters.

Thanks

Seb

Reply
0 Kudos
sbouchex
Enthusiast
Enthusiast

Ok, found the issue on this link : http://communities.vmware.com/message/1623870#1623870

Seb

Reply
0 Kudos
jsong1972
Contributor
Contributor

Hi Steve,

I am a little confused by your reply. Seb is asking how to list counters on a specific datasoture managedobject. But the article mentioned in your reply seems talking about thow to get datastore id.

I encountered the same issue as Seb. When I tried to list counters on a vm entity or host entity, it works well. But the same code throws out an exception if I tried to list counters on a datastore.

I tried both passing an interval or null. Both get the same exception.

            PerfMetricId[] metrics = perfMgr.queryAvailablePerfMetric(me, null, null, pss.getRefreshRate());
            PerfMetricId[] metrics = perfMgr.queryAvailablePerfMetric(me, null, null, null);
Reply
0 Kudos