RICKARD NOBEL AB

RICKARD NOBEL AB

Specialists in IT infrastructure services

Menu
  • About
  • Windows
  • Networking
  • VMware
  • Storage
Menu

ESXi virtual machine network statistics

Posted on January 25, 2016January 26, 2016 by Rickard Nobel

How to display network statistics for virtual machines on ESXi vSwitch. Verify the total number of packets sent or received as well as the amounts of broadcast and multicast frames for a specific VM on a virtual switch.

vmware-vm-network-stat-cisco-1

On many physical switches it is easy to retrieve interface statistics including number of transmitted and received packets, the number of broadcast and multicast frames as well as error reporting.

Corresponding statistics are however not directly available in the GUI for VMware ESXi standard vSwitch, but they are possible to view from the ESXi command line e.g. through SSH.

vmware-vm-network-stat-1

The classic ESXTOP (above) is a great tool, but does only show real-time values and no cumulated statistics. If we would like to see the total amount of sent/received or other statistics we could use the esxcli tool.

We must first find the virtual switch port ID for the VM we are investigating. This could be seen in ESXTOP if few VMs are running, but could also be retrieved through two other commands:

vmware-vm-network-stat-2

First find the VM “world id” with the command:

esxcli network vm list

If you have large amounts of VMs displayed a grep filter could be attached with (parts of) the VM name, as displayed above. Note/copy the number first on the line.

vmware-vm-network-stat-3

Use the command:

esxcli network vm port list -w WORLD-id

This will display the name of the vSwitch, the name of the portgroup, the MAC address, the outgoing physical adapter (vmnic) and also the so called Port ID. The port id is the internal reference to the port for the VM on the virtual switch.

Make a note/copy of the Port ID which will be used in the final esxcli command. (The port ID could also be taken from ESXTOP.)

vmware-vm-network-stat-4

The command for displaying port statistics is:

esxcli network port stats get -p PORT-id

Note that statistics for standard vSwitch are per host, so if a virtual machine is migrated to another ESXi host the statistics will be renewed. If the virtual machine is rebooted the statistics will be kept, but is lost if doing a VM shutdown.

6 thoughts on “ESXi virtual machine network statistics”

  1. Shen says:
    March 15, 2016 at 11:53

    learn that ! also you can use command “net-stats -l” to get portID.

    Reply
  2. chris smith says:
    February 2, 2017 at 06:28

    Great post

    Reply
  3. Hemanth says:
    April 11, 2017 at 14:54

    Awesome Thanks this is the one I was searching for 🙂

    Reply
  4. adnil says:
    March 20, 2018 at 00:03

    Do you know how to reset the stats without having to shut off/on the VM?

    Reply
  5. Krish says:
    April 25, 2019 at 06:33

    Can anyone tell me how to set internal stats

    Reply
  6. Art Cancro says:
    July 12, 2019 at 19:51

    This seems to be the ONE place where you can grab actual interface statistics instead of “average kbps” samples. The API’s all seem to be missing it. Thanks for this post. I was able to reproduce your work, and then rewrote it in PowerCLI using syntax like:

    $esxcli.network.port.stats.get.invoke($args)

    I would have preferred a web API call, but this will have to do.

    Reply

Leave a Reply to Shen Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Verify NTP connectivity in Windows
  • The Ethertype value, part 1
  • Password strength part 1, the mathematical basics
  • MS16-072 breaks Group Policy
  • ESXi virtual machine network statistics
  • Determine the Zeroed status of Thick Lazy disk
  • Eager thick vs Lazy thick disk performance

Contact

Categories

  • Networking
  • Storage
  • VMware
  • Windows

Recent Comments

  • Rickard Nobel on VMXNET3 vs E1000E and E1000 – part 1
  • cees vos on VMXNET3 vs E1000E and E1000 – part 1
  • Filipi Souza on Storage performance: IOPS, latency and throughput
  • Backup vs RAID - Web Hosting on How RAID 5 actually works
  • Stephen on Password strength part 1, the mathematical basics
©2021 RICKARD NOBEL AB