VMware Cloud Community
aralestrip
Contributor
Contributor
Jump to solution

list HBA online links with actual speed

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...

Reply
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

Reply
0 Kudos
5 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

aralestrip
Contributor
Contributor
Jump to solution

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?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

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.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos