Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 176561

script to get targets ,devices and paths

$
0
0


Hi guys

 

Need a script to check how many paths are available from each vhba and also need it to determine if there are any dead paths reported..

 

For example

Output should be like this and it should be export to .csv

vmhba1 :

Targets :2

Devices:10

Paths:9

Dead Path :

vmhba1:c0:t0:l0 Target Lun Status

 

vmhba2:

Targets :2

Devices:10

Paths:10

 

here i found this script some this related to my query but in the below script i am missing cluster name and datacenter name  please help me further to get those details and to  export this data to .csv file

 

script:

 

foreach($esx in Get-VMHost){
  foreach($hba in (Get-VMHostHba -VMHost $esx -Type "FibreChannel")){
    $target = $hba.VMhost.ExtensionData.Config.StorageDevice.ScsiTopology.Adapter |
      where {$_.Adapter -eq $hba.Key} | %{$_.Target}
    $luns = Get-ScsiLun -Hba $hba -LunType "disk" -ErrorAction SilentlyCOntinue | Measure-Object | Select -ExpandProperty Count 
$nrPaths = $target | %{$_.Lun.Count} | Measure-Object -Sum | select -ExpandProperty Sum  
$hba | Select @{N="VMHost";E={$esx.Name}},@{N="HBA";E={$hba.Name}},  
@{N="Target#";E={if($target -eq $null){0}else{@($target).Count}}},@{N="Device#";E={$luns}},@{N="Path#";E={$nrPaths}}

  }
}

 

for example i need details like this

datacenter name : abc

Cluster name : xyz

vmhost : ipaddress

HBA : vmhba 1

targets :

devices :

path :


Viewing all articles
Browse latest Browse all 176561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>