Using API to get info about VMWare datastore

datastorescriptingvmware-esxvmware-vcenter

I need to create a report of datastore capacity, provision and usage. What is the best tool to do that? Vcenter API seems more concerned with creating VMs and such.

Is this the right tool for the job?

Best Answer

The VMware SDK offers very many complex ways to assess you VMware/vSphere server. If you know Perl, have a look at the munin plugin for VMware. Around line 308 you can see that the datastore performance data (how much is used, committed, unshared) per VM is read out. In the loop above that, the metrics per datastore are acquired. With a little modification of the @all_graphs section (line 393ff.) you should be able to create the report you need.

Essentially, the SDK provides a superset of the information found at https://vSpherehost/mob/?moid=ha-host.

Of course, you could also set up a munin server&node and have the datastore usage monitored in real time.

One thing you should be aware of: running the SDK on a free licence of vSphere will only give you read-only access, which also means that the datastore metrics are not updated unless you manually hit refresh in the vSphere Client.