I am using VI sdk to collect performance data of Disk. in that, I want to collect free disk space for VM/ESX, which I am not able to collect using VI SDK or Virtual Center Server....I am able to collect perfomance data like disk usage (KBps) , bytes read/sec etc for both ESX and VM.... But not able to get free disk space counter....
I am using VI SDK 2.5, VC 2.5, and ESX 3.
Can Any one Plz help about this...
Thanks in advance..
In order to retrieve the disk space of VM, you can get the "guest.disk.freeSpace" property of the Virtual Machine to get the free space on the disk, in bytes.
For ESX, you can use get the "datastore" property of the HostSystem to get the number of datastores available with the host. Now, you can sum up the "info.freeSpace" property to get the total free space (in bytes) available with the ESX.
Hope the above information helps.
This information can't be retrieved directly. We need to traverse thru the filesystem details to get space left on the disk.
HostSystem -> HostFileSystemVolumeInfo->[HostFileSystemMountInfo|http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.host.FileSystemMountInfo.html] ->[HostFileSystemVolume|http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.host.FileSystemVolume.html]
In addition you should use below details too,
Typically a FileSystem is exposed as a datatore
You DataStoreInfo object to get mode details.
Just one addition: The only issue "free disk space" has, is a missing link between the guest info and "the rest" of the data. This makes it impossible to see which vm has how much empty disk space where.
U can see how much disk space is left on a partition, seen from within a VM. U cannot see where this partition resides physically as the link between partition and a virtual disk is missing (even a link to layout->disk->key would help here).
So you can find out how much free space is left on a datastore, as how much space is left within a VM. But you can not (easily) find out if the datastore for a given VM-partition has enough space to expand the virtual disk the partition resides on.