Disable storage I/O statistics on datastores in esxi 6.0 and above

  • 5 March 2018
  • 1 reply
  • 2608 views

Userlevel 2
Badge +8
Hello

if anyone else has this issue. I finally got a powershell script to disable Storage I/O statistics collection and Exclude I/O statistics from SDRS.

I use credentials stored in a file so I can run the scripts without entering the password in the clear


param (
[Parameter(Mandatory = $true)][string]$VC,
[Parameter(Mandatory = $true)][string]$DSName
)

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls

# Provide vCenter Host and Credentials
$vcpassword = Get-Content .\vcservice.txt | ConvertTo-SecureString
$vcscred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "tant-a01\vcservice", $vcpassword


# Set vars Name:
#$VCUser = "specify-vcenter-user-here"
#$VCPass = "specify-vcenter-pw-here"
#$DSName = "specify-datastore-name-here"

Connect-VIServer $VC -Credential $vcscred -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 = $true
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($dsMoRef, $spec)


Disconnect-VIServer $vc -Confirm $false

1 reply

Badge
Thank you. This is needed, as there's a bug in vSphere that will reset the setting for disable Storage I/O Statistics whenever the vCenter server is rebooted.
I have quite a few Datastores to modify, so I added a lookup file to your script.

$DSNames = Get-content "DSNames.txt"
foreach ($DSName in $DSNames){
$datastore = Get-Datastore -Name $DSName
$dsView = Get-View $datastore
$dsMoRef = $dsView.MoRef
$spec = New-Object VMware.Vim.StorageIORMConfigSpec
$spec.statsCollectionEnabled = $false
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureDatastoreIORM_Task($dsMoRef, $spec)
}

Reply