Automation

 View Only
  • 1.  list HBA online links with actual speed

    Posted Jan 09, 2013 10:48 AM

    Hi,

    I'd like to list all the HBA links and their actual speed on each Host. I wrote this command:

         Get-VMHost | Get-VMHostHba | where {$_.Status -eq "online"}

    that works fine for listing the devices, but I miss two data:

    - name of the host (I suppose this is to be shown in the first Get-VMHost part - but how?)

    - actual speed of the link (on the host for example I see it with a simple "cat /proc/scsi/qla2xxx/7 | grep speed")

    How can I see all the data available for a single list and than show just the ones I need?

    I'm just starting to play with PowerCli... so any help welcome...



  • 2.  RE: list HBA online links with actual speed
    Best Answer

    Posted Jan 09, 2013 11:07 AM

    VMHost and speed are in the properties of the object that are not shown by default. You can get all the properties with:

    Get-VMHost |
    Get-VMHostHba |
    where-Object {$_.Status -eq "online"} |
    Format-List *
    
    

    If you only want to get the Name, VMHost and Speed properties, you can do:

    Get-VMHost |
    Get-VMHostHba |
    where-Object {$_.Status -eq "online"} |
    Select-Object -Property Name,VMHost,Speed
    
    

    For my hosts the speed is always 0. I am not sure why that is.



  • 3.  RE: list HBA online links with actual speed

    Posted Jan 09, 2013 11:16 AM

    Getting the speed of HBA cards through PowerCLI is a known problem.

    And in fact it is not a PowerCLI problem, but a vSphere problem. The HostFibreChannelHba object always seems to have a 0 for the speed property.

    So the only way left is through the SSH interface.

    See for example Re: get-vmhosthba  (port speed)

    The hostname is available

    Get-VMHost | Get-VMHostHba | where {$_.Status -eq "online"} |
    Select Name, @{N="Host";E={$_.VMhost.Name}}


  • 4.  RE: list HBA online links with actual speed

    Posted Jan 10, 2013 08:54 AM

    Thanku you for the answers. I was hoping to avoid the ssh searching. Strange about the 0 speed that the command gives. Hope this'll be fixed...

    Is it possible to run a ssh command in a single powershell command or do I have to always use a script?



  • 5.  RE: list HBA online links with actual speed

    Posted Jan 10, 2013 09:02 AM

    You can package that script that uses plink.exe in a one-liner, but it will make your code less readable.

    You can package the script in a function, store it somewhere (for example your profile) and then call it with 1 or more parameters.

    That way it will be a single command.

    That's the beauty of PS, you write your own functions that act as a regular cmdlet.



  • 6.  RE: list HBA online links with actual speed

    Posted Jan 10, 2013 09:03 AM

    The Get-Plink function that Luc showed in http://communities.vmware.com/message/1716508#1716508 makes it posible to run a ssh command in a single powershell command. You can see how the Get-Plink function is called in the code below the Get-Plink function definition.