网站统计分析工具(vSphere)

分析ESXI主机的网络流量时,通常使用net-stats、pktcap-uw、nc、iperf这几个工具。1、net-stats该命令可以收集端口统计信息。可以通过net-stats -h命令显示所有标志。最常见的是使用net-stats -l来确定所有VMkernel接口、vmnic上行链路和vNIC端口的交换机端口号和MAC地址。1.1 查看所有支持的标志[root@localhost:~] net-stats -hUsage:-l : List ports in system-a : Print absolute counts instead of per second counts-c <start>:<end> : specify vsi-cache files instead of live kernel-d <level> : verbose/debug level-f : ignore version check-h : this message-i <interval> : Interval for stats collection (default=30 seconds)-n <iterations> : number of iterations to run (default = 1)-o <outfile> : output fileSpecify ports of interest as one of (Prioritized List of options)-A : Get stats for all ports on host-S <switchName> : switch nameLists stats for all non mgmt/test ports-N <pnicName> : pnic nameList stats for all ports on switch that contains 'N'-V <vmname> : VM nameFind switches that contains the VM's ports. Print stats for VM's ports and uplinks-s : Get storage world stats-I : Get SCSI and VSCSI storage I/O stats-D <name> : Name of SCSI device/adapter/path or VMTo be used along with storage stat specsCan be used multiple timeseg: net-stats -I -ta -D vmhba0 -D vmhba1OR specify port spec on command line-p <portid> : portNum-t <type> : specify a string with types of stats neededOR specify port spec in a config file-C <cfgFile> : config file to read stats fromFile Format: <portNum/switchName> <StatsSpec>Stats Spec can contain one or more of these charactersc : Coalesce Stats: Only for vnicsi : Interrupt stats: Only for vmnicsh : Cluster and Packet size histogramsv : virtual nic statse : Detailed error statsq : Queue Stats for port/nicQ : Detailed Queue stats for the port/nicf : Detailed Queue filter information for port/nicW : world stats for the tx, vmnic/vmknic worldsV : vcpu histogramsS : System time breakdown by pcpusn : NIOC statsp : Passthru/sriov statsP : Detailed sriov/passthru statsE : Enable stats collection for ENS moduleFor ENS lcore stats:lcore in : vnic tx/pnic rxlcore out : vnic rx/pnic txI : IOChain InputFilters statsO : IOChain OutputFilters statsStats Spec for Storage stats (-I)d : SCSI Device Statsa : SCSI Adapter Statst : SCSI Path Statss : VSCSI StatsNote:net-stats reads multiple vsi nodes, one at a time, using system callsAs data in the vsi nodes are continuously updated, there is going tobe some inconsistency in numbers, hopefully, not a lotFor ENS lcore stats:lcore in : vnic tx/pnic rxlcore out : vnic rx/pnic tx1.2 查看vmkernel、vNic及MAC地址等的对应关系net-status –l1.3 查看NetQueue或Receive Side Scaling (RSS)是否被vmnic激活net-stats -A -t vW1.4 查看ENS module的端口状态net-stats -A -t E2、Pktcap-uwvSphere ESXi 5.5及之后版本用pktcap-uw代替了tcpdump-uw工具,tcpdump-uw工具只能捕获VMkernel接口级别的数据包。pktcap-uw工具还能捕获uplink、vSwith或vnic级别的数据帧。从下图可以理解从虚拟机vNic到物理网卡的数据流量和抓包点:具体抓包命令请参考:ESXI主机之pktcap-uw抓包3、NCNC是NetCat的缩写,是一个老式的linux命令,用来验证特定端口连接。例如如果要验证磁阵的iSCSI路径及端口是否可达,可以用以下命令:nc -z <destination IP> 32604、IperfIperf是一个带宽工具,它用来测试源和目的地之间的最大带宽。它通常在VM内部使用,也可以在ESXI主机内部使用,它可以使用ESXi主机上的任何VMkernel接口,包括管理网路、磁阵网络、vmotion网络等。4.1拷贝iperf3文件默认情况下,ESXi不允许在服务器模式下从shell运行iperf3,解决方式是创建一个iperf的副本:cp /usr/lib/vmware/vsan/bin/iperf3 /usr/lib/vmware/vsan/bin/iperf3.copy4.2关闭防火墙因为在默认情况下,iperf3运行在ESXi防火墙不允许的端口上。可以通过下面命令暂时关闭防火墙:esxcli network firewall set –enabled false注意:测试完后要启用ESXI防火墙esxcli network firewall set –enabled true4.3目的主机(server)使用iperf3绑定IP在目标ESXi主机上使用-s标记复制。这样做的好处是,所有的VMkernel IP都可以被使用。因此,如果需要测试管理网络,请将iperf3与管理IP绑定。vMotion网络或任何其他VMkernel接口也一样。Server (ESXi host 1):/usr/lib/vmware/vsan/bin/iperf3.copy -s -B [IP]4.4 源主机(client)发送连接测试请求Client (ESXi host 2):/usr/lib/vmware/vsan/bin/iperf3.copy -c [IP]

本文出自快速备案,转载时请注明出处及相应链接。

本文永久链接: https://kuaisubeian.cc/46433.html

kuaisubeian