Reply to Message

View discussion in a popup

Replying to:
Jocker-H
Contributor
Contributor

Please note that i did try this script and there was no output related to I/O  any idea why ?

# Get a list of ESXi hosts
$esxiHosts = Get-VMHost

# Get a list of ESXi clusters
$esxiClusters = Get-Cluster

# Create an array to store the data
$data = @()

# Loop through each ESXi host and add the associated datastores, size, free space, storage array, and I/O details to the data array
foreach ($esxiHost in $esxiHosts) {
$esxiHostName = $esxiHost.Name
$datastores = Get-Datastore -VMHost $esxiHost
$esxiCluster = ($esxiHost | Get-Cluster).Name

foreach ($datastore in $datastores) {
$datastoreName = $datastore.Name
$datastoreSize = $datastore.CapacityGB
$freeSpace = $datastore.FreeSpaceGB

# Get I/O details for the datastore (adjust the time period as needed)
$ioStats = Get-Stat -Entity $datastore -Stat "datastore.numberReadAveraged.average", "datastore.numberWriteAveraged.average" -MaxSamples 1 -Realtime

$data += [PSCustomObject]@{
"ESXi Host" = $esxiHostName
"Datastore" = $datastoreName
"Cluster" = $esxiCluster
"Size (GB)" = $datastoreSize
"Free Space (GB)" = $freeSpace

"Reads per second" = $ioStats | Where-Object { $_.MetricId -eq "datastore.numberReadAveraged.average" } | Select-Object -ExpandProperty Value
"Writes per second" = $ioStats | Where-Object { $_.MetricId -eq "datastore.numberWriteAveraged.average" } | Select-Object -ExpandProperty Value
}
}
}

View solution in original post

Tags (1)
Reply
0 Kudos