exploreeverythi
Contributor
Contributor

How to disable Storage IO Stats collection through PowerCLI?

Looking for a way to disable Datastore's  Storage IO Stats collection through PowerCLI. By default it is set enabled (i.e.True), I need to change it to disabled (i.e. False) on multiple datastores. Any idea how to accomplish this via PowerCLI?

ExtensionData.IormConfiguration.StatsCollectionEnabled

True

Reply
0 Kudos
LucD
Leadership
Leadership

Try like this.

It will disable stats collection for all shared datastores.

$si = Get-View ServiceInstance

$storMgr = Get-View -Id $si.Content.StorageResourceManager

$spec = New-Object VMware.Vim.StorageIORMConfigSpec

$spec.Enabled = $false

$spec.StatsAggregationDisabled = $true

$spec.StatsCollectionEnabled = $false

foreach($ds in (Get-View -ViewType Datastore -Filter @{'Summary.MultipleHostAccess'='True'})){

    Write-Output "Configuring datastore $($ds.Name)"

    $storMgr.ConfigureDatastoreIORM($ds.MoRef,$spec)

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

exploreeverythi
Contributor
Contributor

Thanks Luc! That helps!

Reply
0 Kudos
adamjg
Hot Shot
Hot Shot

Just a warning on this...there's a bug in vSphere 6 and 6.5 where this option gets reset on every datastore after vCenter services are restarted. Keep this script handy and run it whenever you do maintenance that requires services restarts or a reboot of your vCenter.

LucD
Leadership
Leadership

Thanks for sharing that.
I was bitten by that "phenomena" for quite some time before I realised what was happening :smileygrin:


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
adamjg
Hot Shot
Hot Shot

Yep same here...I opened an SR but was told that it will be available in the "next major release". I do have a PR# stashed away somewhere, but it looks like a vSphere 7 thing. PowerCLI to the rescue again, I just have to remember to run the script Smiley Happy

Reply
0 Kudos
bo_busillo
VMware Employee
VMware Employee

adamjg, Could you please shoot me your PR # or SR # so I can follow up on this issue for one of my customers?

Reply
0 Kudos
bo_busillo
VMware Employee
VMware Employee

All does anyone out there have a PR (or) SR I can review one this topic? I am working with the VMware PM's and trying to validate.

Thanks

Bo

Reply
0 Kudos
BenFB
Virtuoso
Virtuoso

VMware bug# 1998168

Reply
0 Kudos
adamjg
Hot Shot
Hot Shot

Sorry, I missed these messages.  The PR # I have from VMware for this issue is 1790041.

Reply
0 Kudos