Automation

 View Only
  • 1.  Collecting HBA and Storage information

    Posted Jun 25, 2010 08:03 AM

    Hello together.

    I am searching for a script that collect for me some HBA and Storage information. We are using vSphere 4 U1 and need a Script that collect following information

    Runtime Name

    Device Display Name

    Identifier

    Capacity

    Datastore Name

    Path Policy

    State (Active / Standby)

    PWWN

    and maybe some Storage Box Information like Vendor, Firmware Version if it is possible.

    I found may examples for some of the needed information but not all together.

    Can someone help me because I'm not a script god.

    Thank you

    Regards,

    ron9999



  • 2.  RE: Collecting HBA and Storage information

    Posted Jun 25, 2010 08:27 AM

    Did you already have a look at LUN report – datastore, RDM and node visibility and yadr – A vdisk reporter ?

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 3.  RE: Collecting HBA and Storage information

    Posted Jun 25, 2010 08:54 AM

    Hi LucD.

    Thanks for this references but these scripts collects information only in view of VMs or not in the deep. I need the Host view with Storage information and in more details.



  • 4.  RE: Collecting HBA and Storage information
    Best Answer

    Posted Jun 25, 2010 12:17 PM
      |   view attached

    Hi Ron,

    I tried to make the script you were searching for, but didn't understand what you mean with "Runtime Name" and I don't know how to retrieve the firmware version. So I let those two out. With the identifier I didn't know which one to choose, because there are more than one. If I have put things on the wrong place maybe you can give an example of a line of output with real data, as you would like to see it.

    Function Get-DatastoreByHba {
      param([string]$Hba)
     
      $Datastores = Get-Datastore | Get-View
      $Datastore = $Datastores | `
        ForEach-Object {$_.Info.Vmfs} | `
        ForEach-Object {
          $Vmfs = $_
          $Vmfs | `
          ForEach-Object {$_.Extent } | `
          Where-Object {$_.DiskName -eq $Hba} | `
          ForEach-Object {$Vmfs.Name}
        }
      Return $Datastore
    }
    
    $Datastores = Get-Datastore | Get-View
    Get-VMHost | ForEach-Object {
      $VMHost = $_
      $VMHostHBA = $VMost | Get-VMHostHba
      $VMHost | Get-ScsiLun | ForEach-Object {
        $ScsiLun = $_
        $ScsiLun | Get-ScsiLunPath | ForEach-Object {
          $ScsiLunPath = $_
          $HBA = $VMHostHBA | Where-Object { $_.Device -eq $ScsiLunPath.Name.Split(":")[0]}
          $wwn = $HBA.PortWorldWideName
          $wwnhex = "{0:x}" -f $wwn	    
          $Report = "" | Select-Object -Property VMHost,Device,Identifier,CapacityMB,Datastore,MultipathPolicy,State,PWWN,Vendor
          $Report.VMHost = $VMHost.Name
          $Report.Device = $ScsiLunPath.Name
          $Report.Identifier = $ScsiLunPath.ScsiLunID
          $Report.CapacityMB = $ScsiLun.CapacityMB
          $Report.Datastore = Get-DatastoreByHba -Hba $ScsiLunPath.Name
          $Report.MultipathPolicy = $ScsiLun.MultipathPolicy
          $Report.State = $ScsiLunPath.State
          $Report.PWWN = $wwnhex
          $Report.Vendor = $ScsiLun.Vendor
          $Report
        }
      }
    }
    
    

    The PWWN conversion code is borrowed from LucD.

    Because the forum software has problems with square brackets, and the script contains them, I have attached the script also.

    Regards, Robert

    Attachment(s)

    ps1
    Get-LunInfo.ps1   1 KB 1 version


  • 5.  RE: Collecting HBA and Storage information

    Posted Jun 28, 2010 08:34 AM

    Hi Robert.

    First of all many thanks for that script. The mostly information i need are inside.

    With "Runtime Name" is the following string meant "vmhba3:C0:T2:L3", but i think it is not really necessary.

    Two fields are empty in my output.

    PWWN and Datastore. Have you any idea why?

    Is it possible to export all the information for later analyse?

    Thanks

    Regards,

    ron9999