How to Disable Storage I/O Stats Collection with PowerCLI or vRO

I recently came across a thread asking about how to disable Storage I/O Statistics Collection using PowerCLI. The thread referenced this article by Michael Webster: Disable SIOC IO Metrics Collection For Auto Tiering Storage Systems . In one of the comments, someone asked about using PowerCLI.. Unfortunately there was no answer there so I thought - I might be able to figure this out! With regards to checking that box, I can't say whether it's a good idea or not, my purpose here was just to illustrate how to do it via PowerCLI and vRO.

Goal

The overall goal of this post is to teach you how to Disable Storage I/O Statistics Collection using PowerCLI... more importantly, I will step you through my approach as a vRO guy trying to figure out how to create some PowerCLI code to accomplish the task. Once I'm done, I'll also provide a simple vRO workflow to do the same...

I'm a vRO guy with MINIMAL PowerShell and PowerCLI experience. One thing I AM familiar with is the fact that the current version of Onyx works with the vSphere Web Client and is able to produce PowerCLI code based on recorded actions in the client. I'm still waiting for some developer-type people to get this tool updated to output vRO Javascript like the old version did....ok.. enough babbling... let's get on with how to actually do this.

First off, make sure you have Onyx installed in your vSphere Web Client. Then, proceed as follows...

vSphere Web Client - View Datastore General Settings

b_600_0_16777215_01_images_How_to_Disable_Storage_IO_Stats_Collection_with_PowerCLI_or_vRO_vSphere_Web_Client_-_View_Datastore_General_Settings_lg.png
As seen in the screenshot, navigate to the Datastore you wish to modify. It's important to get the client to the object you wish to modify BEFORE starting the ONYX recording tool in order to minimize the amount of code that gets generated. As you'll see, it generates quite a bit!

  1. Now, Click the Record Button at the top of your vSphere Web Client
  2. Next, Click EDIT next to Datastore Capabilities

vSphere Web Client - Adjust Desired Settings

vSphere Web Client - Adjust Desired Settings
  1. Note that the red circle is now a red squre (stop) to indicate that Onyx is recording your actions...
  2. Adjust the settings as desired.. for this article, we are focusing on Disable Storage I/O statistics collection so enable the checkbox there
  3. Click OK when Done
  4. Click the Onyx icon to the right of the Red square at the top of the client

vSphere Web Client Onyx UI

vSphere Web Client Onyx UI
  1. Click the "Stop" button -- once clicked, the button changes to "Start" as shown in the screenshot
  2. Once recording has stopped, the code will appear in the text area

As you can see, quite a bit of code got generated:

# ------- ConfigureDatastoreIORM_Task -------
$datastore = New-Object VMware.Vim.ManagedObjectReference
$datastore.value = 'datastore-61'
$datastore.type = 'Datastore'
$spec = New-Object VMware.Vim.StorageIORMConfigSpec
$spec.percentOfPeakThroughput = 95
$spec.statsCollectionEnabled = $false
$spec.enabled = $false
$spec.congestionThreshold = 30
$spec.congestionThresholdMode = 'automatic'
$spec.statsAggregationDisabled = $true
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($datastore, $spec)

# ------- getRuntime -------
$_this = Get-View -Id 'HostSystem-host-129'
$_this.getRuntime()

# ------- getContent -------
$_this = Get-View -Id 'ServiceInstance-ServiceInstance'
$_this.getContent()
 
# ------- getCapabilities -------
$_this = Get-View -Id 'HostDatastoreSystem-datastoreSystem-129'
$_this.getCapabilities()
 
# ------- getRuntime -------
$_this = Get-View -Id 'HostSystem-host-129'
$_this.getRuntime()

# ------- getContent -------
$_this = Get-View -Id 'ServiceInstance-ServiceInstance'
$_this.getContent()
 
# ------- getCapabilities -------
$_this = Get-View -Id 'HostDatastoreSystem-datastoreSystem-129'
$_this.getCapabilities()

Okay, there's a bunch of stuff on there statically coded based on my selections in the vSphere Web Client...Based on what we actually want here, it looks like the most relevant bit of code is that top chunk, everything after that seems irrelevant so were are now left with:

# ------- ConfigureDatastoreIORM_Task -------
$datastore = New-Object VMware.Vim.ManagedObjectReference
$datastore.value = 'datastore-61'
$datastore.type = 'Datastore'
$spec = New-Object VMware.Vim.StorageIORMConfigSpec
$spec.percentOfPeakThroughput = 95
$spec.statsCollectionEnabled = $false
$spec.enabled = $false
$spec.congestionThreshold = 30
$spec.congestionThresholdMode = 'automatic'
$spec.statsAggregationDisabled = $true
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($datastore, $spec)

Alright, now, looking through the settings here, we can comment out several lines that are for other settings (unless you also want the ability to set those as well), giving us:

# ------- ConfigureDatastoreIORM_Task -------
$spec = New-Object VMware.Vim.StorageIORMConfigSpec
# $spec.percentOfPeakThroughput = 90
$spec.statsCollectionEnabled = $false
# $spec.enabled = $false
# $spec.congestionThreshold = 30
# $spec.congestionThresholdMode = 'automatic'
# $spec.statsAggregationDisabled = $false
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($datastore, $spec)

Okay, we're getting closer now, but there are still static values in here... after a few minutes of googling around various blog sites, I updated the code to the following:

# Provide vCenter Host and Credentials
$VCUser = "specify-vcenter-user-here"
$VCPass = "specify-vcenter-pw-here"
$VCIP = "specify-vcenter-ip-or-fqdn-here"
# Set Datastore Name:
$DSName = "specify-datastore-name-here"

$connection = Connect-VIServer -Server $VCIP -User $VCUser -Password $vcpass -WarningAction SilentlyContinue
$datastore = Get-Datastore -Name $DSName
$dsView = Get-View $datastore
$dsMoRef = $dsView.MoRef

# ------- ConfigureDatastoreIORM_Task -------
$spec = New-Object VMware.Vim.StorageIORMConfigSpec
# $spec.percentOfPeakThroughput = 90
$spec.statsCollectionEnabled = $false
# $spec.enabled = $false
# $spec.congestionThreshold = 30
# $spec.congestionThresholdMode = 'automatic'
# $spec.statsAggregationDisabled = $false
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($dsMoRef, $spec)

We now should have a working script... so, go back to your datastore and uncheck the box... then try running your new script!

Launch your vRO Client

Launch vRO Client

There aren't any out of the box workflows or actions that do this that I'm aware of... but, looking at the code above, I see a couple really important objects:

  • StorageResourceManager
  • StorageIORMConfigSpec

... and then, the various properties of the spec ...
and a method to apply the spec:

  • ConfigureDatastoreIORM_Task()

So, based on that, use the API explorer in vRO to look for those Scriptable Objects..

Review the API Explorer

Review the API Explorer
  1. At the top of your vRO Client, click on Tools - > API Explorer
  2. Enter ConfigureDatastore in the Containing text box
  3. Click SEARCH
  4. Inspect the results in the bottom pane, and double-click on the entry with configureDatastoreIORM_Task in it
  5. You should be taken to that method in the tree on the left
  6. Note that the method is tied to the VcStorageResourceManager object - slightly different name (preceded by Vc) than the PowerCLI equivalent

Okay, this is good, things are aligning to what we found in PowerCLI - let's create a simple workflow!

Workflow: Disable IO Stats Collection

Workflow - Disable I/O Stats Collection

Create a new workflow with:

  • Scriptable Task -. Name the scriptable task Disable IOStats Collection
  • Action --> vim3WaitTaskEnd

Scriptable Task: Disable IOStats Collection

Scriptable Task: Disable IOStats Collection

We'll keep this simple so add a single input to the Scriptable task to pass in the Datastore object we wish to modify:

  1. Select the Disable IOStats Collection Scriptable task
  2. Make sure the IN tab is selected
  3. Click the button to add a new parameter (when prompted, click the "Create parameter/attribute in workflow" link in the Chooser window that comes up
  4. In the Create parameter window, name the parameter datastore
  5. Use the Filter box to filter on "datastore"
  6. Scroll through the Type box and verify that VC:Datastore is selected
  7. Set the option to Create workflow INPUT PARAMETER with the same name
  8. Click OK when done
  9. Now, on the OUT Tab, create a new ATTRIBUTE named "task" of type VC:Task
  10. Click on the Scripting tab when done

Scriptable Task: Disable IOStats Collection - Script

Fortunately, Onyx did the hardest work for us earlier - even though it generated PowerCLI code, it identified the important objects and methods required to accomplish the task at hand. Based on that earlier code and a bit of experience with vRO JavaScript, I managed to convert the code to vRO-ready code as follows:

var storageResourceManager = datastore.sdkConnection.storageResourceManager;
var spec = new VcStorageIORMConfigSpec();
spec.statsCollectionEnabled = false;
var task = storageResourceManager.configureDatastoreIORM_Task(datastore, spec);

 

The first line sets oup our Storage manager. Using the API Explorer, I was able to determine that the StorageManager was a property of the SdkConnection object - AND - the SdkConnection is typically a property of most vCenter objects, such as a Datastore!

The next line Initializes a new object that will be used for the vCenter Storage IO Resource Manager Configuration Spec (VcStorageIORMConfigSpec).

Line 3 sets the statsCollectionEnabled value to false.

The final line runs the configureDatastoreIORM_Task methond, passing in the datastore object and the config spec. It returns a VC:Task object (this can be determined by inspecting the method using the API Explorer) and assigning the resulting object to the task variable.

Next, we need to wait for that task to complete - that is handled by the action we added to the workflow...

Scriptable Task: Disable IOStats Collection - vim3WaitTaskEnd bindings

Scriptable Task: Disable IOStats Collection - vim3WaitTaskEnd bindings
  1. Now, we need to bind the inputs and outputs for the vim3WaitTaskEnd action so select it
  2. Select the Visual Binding tab
  3. Drag the task in from the center section to the bottom left
  4. Release on the existing In Attribute: task (VC:Task)
  5. Drag Progress to the In Attributes box as well, initially, the "progress" attribute won't be there so release the attribute in the white-space of the box. You'll then be prompted to create the attribute so just click OK
  6. Drag pollRate to the In Attributes box to create and bind that attribute just like the progress attribute
  7. On the right side, drag actionResult down to the Out Attributes box and release, click OK to create that attribute
  8. Finally, click Validate to make sure the workflow is ready
  9. Click Save and close when done

Our next step is to test the workflow and confirm it works. Before proceeding to the next step, be sure that you have UNCHECKED the box if you had checked it manually or via PowerCLI as shown earlier in this article.

Test the Disable IOStats Collection Workflow

Test the Disable IOStats Collection Workflow

Run the workflow, select the Datastore you wish to take action and and Submit.

When done, check vSphere Web Client and confirm that the box is checked!

Summary

While this article focused on a specific use case, the approach taken here can be used for many other vCenter tasks as well. I sincerely hope you have gained a new appreciation for the Onyx client, PowerCLI, and vRealize Orchestrator (vRO).

 

Search

Book Shelf

 
Experts Exchange

NUC Lab Kit

Below are my thoughts for a vSAN nuc lab. Since I already have cables, not including them here. I ordered (and received by Nov 30, 2016)
3 x nuc, 3 x 32GB Crucial mem, 3 x Toshiba NVMe drive, 3 x Startech USB to GB NIC, and 3 x Crucial 1TB SSD. I've also been very happy with my Cisco SG300-10 so I bought one more since my existing one only has one port available. Each of the items listed here are linked below - all were purchased using the provided links below.
single NIC (See this post for details on using the USB -> GB NIC item listed below

I stayed with the i5 for the power consumption and form factor vs. the i7 Skull Canyon ;)