

There is a nearly 100% chance that this setup will fail one day. In most cases, the reason for this was the usage of thin-provisioned disks together with small datastores. This is a situation that never should happen, and I had to deal with it only a couple of times in more than 10y working with VMware vSphere/ ESXi.

$data = 0 $i -lt $ posting is ~3 years years old. # Extract data to custom object and return as array Get-Stat2 -Entity $vm.Extensiondata -Stat "" -Interval "RT" The VMid is the value property of the MoRef of a specific virtual machine. Unshared space, in KB, per virtual machine on the datastoreĪctually used space, in KB, on the datastoreĪctually used space, in KB, for a specific virtual machineĪctually used space, in KB, for snapshot filesĪctually used space, in KB, for the swap filesĪctually used space, in KB, for all other virtual machine related files Provisioned space, in KB, for a specific virtual machine Provisioned space, in KBm for the complete datastore CounterĬapacity, in KB, for the complete datastore According to the SDK Reference page, the Storage Capacity metrics support the following instances. What instances ?Īs with most metrics, you have the option to use the instance property, to identify which specific statistical data you want to retrieve. This required some fundamental changes to the Get-Stat2 script, but in the end I got it working. Although the SDK Reference states that you can either use begintime/ endtime or intervalId, it seems that for datastores the PerformanceManager methods only want you to use beginTime and endTime.
DATASTORE USAGE ON DISK ALARM CLEARING .SNAPSHOT TRIAL
Unfortunately none of these posts provided me with a workable solution.Īfter some trial and error, I discovered that the problem was caused by the intervalId property. A quick search through the VMTN posts showed that I was not the first one seeing that error when using datastore metrics. On each call I seemed to get an error, stating “optional value not set”. Next problem! The “optional value not set” error Once it has these it calls the QueryPerf method to get the actual statistical data. The script uses a number of methods on the PerformanceManager object, to retrieve the counterId and available instances for the metrics. No problem, I have an older post, called Get-Stat2 : another way of getting at the statistical data, which I should be able to adapt to retrieve datastore statistics. Which brings us immediately to the first problem, the current Get-Stat cmdlet doesn’t accept datastore entities. In this case we obviously want the metrics for the datastore. The SDK Reference, on the Storage Capacity page, mentions that these metrics are available for virtual machines and for datastores. But was it ? As it turned out there are a few gotchas! Getting there With the, and metrics this should be a simple script. Can one extract the datastore statistics, that are used for the space utilization graphs in the vSphere Client, with PowerCLI ? The graph in question, which you find in the Datastores Inventory view under the Performance tab, looks something like this.Ī quick browse through the available metrics, on the SDK Reference PerformanceManager page, showed that these metrics are indeed available. An interesting question came up in the PowerCLI Community.
