I'm hoping you all can help. I am looking for a script that will connect to vCenter(4.1U1) then walk all the ESXi Hosts (4.1) check the hba's (storage adapters) and gather targets, devices and paths. If there is a discrepancy email me the findings. ( I will be adding this script as part of a scheduled task)
An example would be 1 hba has Targets: 2 Devices: 25 Paths: 50 while the other hba has something different.
Yes, I can use alarms but, I am just being overly cautious.
Hi Troy,
the next script gives you all the counters. Now I have to think about an extension to this script that does the compare and emails if it finds a discrepancy.
Get-Cluster | Sort-Object -property Name | ForEach-Object { $Cluster = $_ $Cluster | Get-VMHost | Sort-Object -property Name | ForEach-Object { $VMHost = $_ $VMHost | Get-VMHostHba | Sort-Object -property Device | ForEach-Object { $VMHostHba = $_ $ScsiLun = $VMHostHba | Get-ScsiLun If ($ScsiLun) { $ScsiLunPath = $ScsiLun | Get-ScsiLunPath | Where-Object {$_.Name -like "$($VMHostHba.Device)*"} $Targets = ($ScsiLunPath | ` Group-Object -Property SanID | Measure-Object).Count $Devices = ($ScsiLun | Measure-Object).Count $Paths = ($ScsiLunPath | Measure-Object).Count } Else { $Targets = 0 $Devices = 0 $Paths = 0 } $Report = "" | Select-Object -Property Cluster,VMHost,HBA,Targets,Devices,Paths $Report.Cluster = $Cluster.Name $Report.VMHost = $VMHost.Name $Report.HBA = $VMHostHba.Device $Report.Targets = $Targets $Report.Devices = $Devices $Report.Paths = $Paths $Report } } }
Regards, Robert
Thanks Robert, a great start!!