Automation

 View Only
Expand all | Collapse all

ESXi Hosts pNIC get rx ring buffer size

  • 1.  ESXi Hosts pNIC get rx ring buffer size

    Posted Aug 17, 2020 08:41 AM

    Could someone help me get the ring buffer values from all the ESXi hosts for all the vmnics? I'm trying to get the hostname, vmnic name and its corresponding rx buffer values (both current and preset).

    $Hosts = Get-VMhost

    foreach ($ESXi in $Hosts) {

        $esxcli = Get-EsxCli -VMHost $ESXi -V2

        foreach ($vmnic in $EsxCli.network.nic.list.Invoke()) {

            ForEach-Object -Process {

                $EsxCli.network.nic.ring.current.get.Invoke(@{nicname = $vmnic.Name})

                $EsxCli.network.nic.ring.preset.get.Invoke(@{nicname = $vmnic.Name})

            }

        }

    }

    Although the above code gives me the values, it still produces errors.



  • 2.  RE: ESXi Hosts pNIC get rx ring buffer size
    Best Answer

    Posted Aug 17, 2020 08:54 AM

    Most of the time this error indicates in this case that the retrieval of the value is not supported by the NIC.

    You will have to check the log to make sure.

    If you run it like this, that error won't stop your script

    Get-VMhost -PipelineVariable esx |

    ForEach-Object -Process {

        $esxcli = Get-EsxCli -VMHost $esx -V2

        $esxcli.network.nic.list.Invoke() |

        Select @{N='VMHost';E={$esx.Name}},

            @{N='vmnic';E={$_.Name}},

            @{N='Current';E={$esxcli.network.nic.ring.current.get.Invoke(@{nicname = $_.Name}).RX}},

            @{N='Preset';E={$esxcli.network.nic.ring.preset.get.Invoke(@{nicname = $_.Name}).RX}}

    }



  • 3.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 10:51 AM

    HI Luc,

    Thank you so mutch for your script. It was very helpfull for me.

    Is there any option to modify it to "set" ring buffer only for host in specific cluster?

    When i try something like this

    $esxes = Get-VMhost |where {$_.Name -like 'hosts in first cluster*'}
    ForEach ($esx in $esxes) {

        $esxcli = Get-EsxCli -VMHost $esx -V2

         $esxcli.network.nic.list.Invoke() |

            $esxcli.network.nic.ring.current.set(@{nicname = $_.Name} -r 8192)
    }

    the command $esxcli.network.nic.ring.current.set(@{nicname = $_.Name} -r "8192")  is underlined as error.

    I made this command based on your "get script" and this information:

    $esxcli.network.nic.ring.current.setnicname
    rx
    rxjumbo
    rxmini
    tx



  • 4.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 11:08 AM

    When you use the V2 switch, you have to use the Invoke method.

    See PowerCLI 6.3 R1: Get-ESXCLI Why the V2?



  • 5.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 11:24 AM

    Thank you Luc,

    but even though i use invoke as you stated,  "  $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $_.Name} -r 8192)  "

    still got red underlined for it.

    Did i make a typo in the command or what is wrong with it.

    Could you please guide me about this?



  • 6.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 11:31 AM

    Did you actually read that post I pointed to?
    All the parameters need to be in a hash table, something like this for example

    $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $_.Name;rx=8192})



  • 7.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 01:14 PM

    HI Luc,

    thank you for your quick replay.

    i read this article but i'm new in powershell/powercli so this is not easy for me to understand.

    Could you please tell me where my logic failed?

    $esxes = Get-VMhost |where {$_.Name -like 'esxhosts'}

    ForEach ($esx in $esxes) {

        $esxcli = Get-EsxCli -VMHost $esx -V2

         $nics = ($esxcli.network.nic.list.Invoke()).Name

            ForEach ($nic in $nics)  {
                $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $nic;rx=8192})
            }

    }

    i got output like below:

         $nics = ($esxcli.network.nic.list.Invoke()).Name

            ForEach ($nic in $nics)  {

                $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $nic;rx=8192})

            }

    Message: EsxCLI.CLIFault.summary;

    InnerText: Unable to complete Sysinfo operation.  Please see the VMkernel log file for more details.: Sysinfo error: Bad parameterSee VMkernel log for details.EsxCLI.CLIFault.summary

    At line:4 char:13

    +             $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $ ...

    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : OperationStopped: (:) [], MethodFault

        + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault

    Message: EsxCLI.CLIFault.summary;

    InnerText: Unable to complete Sysinfo operation.  Please see the VMkernel log file for more details.: Sysinfo error: Bad parameterSee VMkernel log for details.EsxCLI.CLIFault.summary

    At line:4 char:13

    +             $esxcli.network.nic.ring.current.set.Invoke(@{nicname = $ ...

    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : OperationStopped: (:) [], MethodFault

        + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault



  • 8.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 01:34 PM

    The maximum RX value is 4096.

    See also KB2039495



  • 9.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 01:42 PM

    I understood it, but i'm refering to this VMware Knowledge Base

    and according to VMware support we need to increase ring buffer to 8192 on all our affected hosts.

    That is why i tried to do it via script.



  • 10.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 15, 2020 02:23 PM

    Where do you see VMware saying it must be 8192 in that KB?



  • 11.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 16, 2020 06:15 AM

    Hi Luc,

    We have in Vmware support opened case and they recommended to set this value in our environment.



  • 12.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 16, 2020 06:36 AM

    Can you change the value to 8192 with the esxcli command on the ESXi console?
    If not, perhaps ask support on how to do it.

    If that works, there might be a bug in the Get-EsxCli cmdlet.t

    Are they talking about a VMXNet3 adapter?



  • 13.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 16, 2020 07:49 AM

    Thank you Luc for your suggestion.

    When i tried to set this value from ESX console i received error as well, but it pointed me out, that i must set TX value as well.

    this is working fine now.

    $esxes = Get-VMhost |where {$_.Name -like 'ESXiHosts*'}

    ForEach ($esx in $esxes) {

        $esxcli = Get-EsxCli -VMHost $esx -V2

         $nics = ($esxcli.network.nic.list.Invoke()).Name

            ForEach ($nic in $nics)  {
                $esxcli.network.nic.ring.current.set.Invoke(@{nicname=$nic;rx='8192';tx='8192'})
            
            }    
    }

    Are they talking about a VMXNet3 adapter? -- no, they stated this value for physical uplinks from ESXi hosts.



  • 14.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted Oct 16, 2020 09:21 AM

    Good to hear you got it solved.



  • 15.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted May 17, 2021 07:26 PM

    Did you run this script to change the ring buffer size without putting the hosts in the maintenance mode in your environment?



  • 16.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted May 22, 2023 10:46 PM

    Thanks for share,

    I added some strings to get both RX and TX.

     


    Get-VMhost -PipelineVariable esx |
    ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $esx -V2

    $esxcli.network.nic.list.Invoke() |

    Select @{N='VMHost';E={$esx.Name}},

    @{N='vmnic';E={$_.Name}},

    @{N='RingSizeRX';E={$esxcli.network.nic.ring.current.get.Invoke(@{nicname = $_.Name}).RX}},

    @{N='RingSizeTX';E={$esxcli.network.nic.ring.current.get.Invoke(@{nicname = $_.Name}).TX}}
    }

     

     

    Is it also possible to only get specific vmnic results. With above script, I get all vmnics for all hosts. For example I only need to see RX TX of vmnic6 and vmnic8 in my vcenter. How can I do it?

    Also is it possible run set script to change ring buffer sizes without putting hosts in maintenance mode and/or reboot hosts?



  • 17.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted May 23, 2023 08:36 AM

    You could use a Where-clause

     

    Get-VMhost -PipelineVariable esx |
    ForEach-Object -Process {
       $esxcli = Get-EsxCli -VMHost $esx -V2
       $esxcli.network.nic.list.Invoke() |
       Where-Object {$_.Name -match "^vmnic6$|^vmnic8$"} |
       Select @{N='VMHost';E={$esx.Name}},
          @{N='vmnic';E={$_.Name}},
          @{N='RingSizeRX';E={$esxcli.network.nic.ring.current.get.Invoke(@{nicname = $_.Name}).RX}},
          @{N='RingSizeTX';E={$esxcli.network.nic.ring.current.get.Invoke(@{nicname = $_.Name}).TX}}
    }

     



  • 18.  RE: ESXi Hosts pNIC get rx ring buffer size

    Posted May 23, 2023 10:20 AM

    Thank you this worked.