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.
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…
First off, make sure you have Onyx installed in your vSphere Web Client. Then, proceed as follows…
vSphere Web Client - View Datastore General Settings
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!
- Now, Click the Record Button at the top of your vSphere Web Client
- Next, Click EDIT next to Datastore Capabilities
vSphere Web Client - Adjust Desired Settings
- Note that the red circle is now a red squre (stop) to indicate that Onyx is recording your actions…
- Adjust the settings as desired.. for this article, we are focusing on Disable Storage I/O statistics collection so enable the checkbox there
- Click OK when Done
- Click the Onyx icon to the right of the Red square at the top of the client
vSphere Web Client Onyx UI
- Click the “Stop” button – once clicked, the button changes to “Start” as shown in the screenshot
- Once recording has stopped, the code will appear in the text area
As you can see, quite a bit of code got generated:
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:
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:
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:
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
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:
… and then, the various properties of the spec …
and a method to apply the spec:
So, based on that, use the API explorer in vRO to look for those Scriptable Objects..
Review the API Explorer
- At the top of your vRO Client, click on Tools - > API Explorer
- Enter ConfigureDatastore in the Containing text box
- Click SEARCH
- Inspect the results in the bottom pane, and double-click on the entry with configureDatastoreIORM_Task in it
- You should be taken to that method in the tree on the left
- 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
Create a new workflow with:
- Scriptable Task -. Name the scriptable task Disable IOStats Collection
- Action –> vim3WaitTaskEnd
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:
- Select the Disable IOStats Collection Scriptable task
- Make sure the IN tab is selected
- 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
- In the Create parameter window, name the parameter datastore
- Use the Filter box to filter on “datastore”
- Scroll through the Type box and verify that VC:Datastore is selected
- Set the option to Create workflow INPUT PARAMETER with the same name
- Click OK when done
- Now, on the OUT Tab, create a new ATTRIBUTE named “task” of type VC:Task
- Click on the Scripting tab when done
Scriptable Task: Disable IOStats Collection - Script
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
- Now, we need to bind the inputs and outputs for the vim3WaitTaskEnd action so select it
- Select the Visual Binding tab
- Drag the task in from the center section to the bottom left
- Release on the existing In Attribute : task (VC:Task)
- 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
- Drag pollRate to the In Attributes box to create and bind that attribute just like the progress attribute
- On the right side, drag actionResult down to the Out Attributes box and release, click OK to create that attribute
- Finally, click Validate to make sure the workflow is ready
- 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
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!
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).