VMware Cloud Community
eclarkcci
Contributor
Contributor

PowerCLI to Gather FIFO stats on VMNIC of a hosts in a cluster

Hello,

For this question, please consider this:

Here is a command that is used on each ESXi host to get the network stats (FIFO errors) from VMNIC0.

[root@BW-21-ESX-09:~] esxcli network nic stats get -n vmnic0 | grep -i fifo

   Receive FIFO errors: 4295316551

   Transmit FIFO errors: 0

[root@BW-21-ESX-09:~]

We are seeing FIFO errors on many ESXi hosts and I would like to build a PowerCLI script in order to gather the FIFO stats for each ESXi host in a given cluster.

What would be a good way to get that done using PowerCLI? If I can figure out the right method and command set, we can export it to file and then process with SSRS.

The trouble I am having is changing the ESXCLI command to PowerCli in order to gather this FIFO stat for all NICs for all ESXi hosts in vCenter.

Any suggestions would be greatly appreciated - this would save us a ton of time and effort - over time I may be able to figure this out but ATM I am over my head, I admit.

Basic output would look like what you see above, but for each host.

Thanks,

Eric

Tags (2)
Reply
0 Kudos
1 Reply
Gidrakos
Hot Shot
Hot Shot

You'll want to use the Get-ESXcli commandlet for PowerCLI : VMware vSphere 5.1

$esxcli = Get-EsxCli -VMHost [Hostname]

..then can use PowerShell's built-in "grep" (Select-String -or- sls) to do it:

$esxcli.network.nic.stats.get("vmnic0") | out-string -stream | sls "FIFO"

The out-string is necessary because the streamed output of the $esxcli isn't a string, and therefore sls can't do it's job.

Also, you can put wildcards in your Get-EsxCli -VMHost, so you can grab more than one host at a time.

Reply
0 Kudos