I am trying to find the number of active paths to just a single Lun, for monitoring whether I had a fiber connection go down. I keep getting boxed in a corner, because at first just using a Get-view of a host and fish around in the multipathsection. But really I want to simply test 1 Lun on all my hosts to see how many active paths each host has to it. And it appears any of the Get-ScsiXX commands you cannot specify a single lun.
Am I getting confused somewhere?
Did you try it like this
$canonicalname = "naa.600507540180809ef0000000000001ba"
$esx = Get-VMHost -Name MyEsx
Get-ScsiLun -VMHost $esx -CanonicalName $canonicalname |
Select CanonicalName,
@{N="Active Paths";E={Get-ScsiLunPath -ScsiLun $_ | where {$_.State -eq "active"} | Measure-Object | Select -ExpandProperty Count}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try it like this
$canonicalname = "naa.600507540180809ef0000000000001ba"
$esx = Get-VMHost -Name MyEsx
Get-ScsiLun -VMHost $esx -CanonicalName $canonicalname |
Select CanonicalName,
@{N="Active Paths";E={Get-ScsiLunPath -ScsiLun $_ | where {$_.State -eq "active"} | Measure-Object | Select -ExpandProperty Count}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
aha! Yes I bet that will work. I was trying to figure out how to do this with naa ID. Let me try this first thing in the morning, I will post back.
Tested. Works great!