ESXi: How to see network statistics for vSwitch port using esxcli
We are all familiar with Vmware ESXii vSwitches and how vSwitch ports are assigned to each machine individually. The vsphere client is a powerful tool for configuring vswitches, ports and VMs, but I prefer the black background and white font any day.
First step is to get the ID of the network port for the specific VM with esxtop command.
Identify vSwitch port ID using esxtop:
Run the "esxtop" command and press "n" key to get network statistics:
Code:
11:06:47am up 214 days 15:41, 531 worlds, 9 VMs, 36 vCPUs; CPU load average: 0.12, 0.12, 0.12
PORT-ID USED-BY TEAM-PNIC DNAME PKTTX/s MbTX/s PKTRX/s MbRX/s %DRPTX %DRPRX
33554433 Management n/a vSwitch0 0.00 0.00 0.00 0.00 0.00 0.00
33554434 vmnic0 - vSwitch0 0.02 0.00 0.01 0.00 0.00 0.00
33554435 Shadow of vmnic0 n/a vSwitch0 0.00 0.00 0.00 0.00 0.00 0.00
33554436 vmk0 vmnic0 vSwitch0 0.06 0.00 0.03 0.00 0.00 0.00
33554437 35158:VM1-FreeBSD_10 vmnic0 vSwitch0 0.05 0.00 0.07 0.00 0.00 0.00
33554442 519765:VM3-Debian_7 vmnic0 vSwitch0 0.00 0.00 0.00 0.00 0.00 0.00
Net network port ID is the first column in above output.
Show vswitch port network statistics with esxcli:
I want to check packets statistics for network port for specific virtual maine.
Code:
~ # esxcli network port stats get -p 33554437
Packet statistics for port 33554437
Packets received: 2377693275
Packets sent: 1292564023
Bytes received: 2809055922449
Bytes sent: 154202952557
Broadcast packets received: 6403592
Broadcast packets sent: 99273
Multicast packets received: 356330
Multicast packets sent: 14116273
Unicast packets received: 2370933353
Unicast packets sent: 1278348477
Receive packets dropped: 9164
Transmit packets dropped: 0