nic_monitor-全面监控以太网、IB、RoCE网络流量的工具

本文提供三个工具,1. nic_monitor 使用脚本语言 Bash Shell 编写的,用来监控以太网或者RDMA接口流量使用的。 2. nic_monitor_v2.0_eth.py 通过TUI界面实时显示以太网流量的工具,使用Python3编写的。3. nic_monitor_v2.1_rdma.py 通过TUI界面实时显示 IB RoCE 流量的工具,使用Python3编写的。

工具如下:

 

nic_monitor

nic_monitor 使用脚本语言 Bash Shell 编写的,用来监控以太网或者RDMA接口流量使用的。

语法:

 

nic_monitor [options] <port name>

帮助信息如下:

# ./nic_monitor -h

nic_monitor-v0.0.2

nic_monitor [options] <port name>

 

      -er <port name>      show ethernet recevie traffic.

 

      -es <port name>      show ethernet send traffic.

 

      -ea <port name>      show ethernet send and recv traffic.

 

      -rr <port CA name>      show RDMA port receive traffice.

 

      -rs <port CA name>      show RDMA port send traffic.

 

      -ra <port CA name>      show RDMA port send and recv traffice.

 

      -h or --help      show help information.

 

For Example:

  nic_monitor -er ens3f0np0      show ethernet port 'ens3f0np0' receive traffic.

  nic_monitor -ee ens3f0np0      show ethernet port 'ens3f0np0' send traffic.

  nic_monitor -rr mlx5_0      show the rdma port CA name is 'mlx5_0'

  nic_monitor -rs mlx5_0      show the rdma port CA name is 'mlx5_0'

 

Author: Bob Pang

E-mail: pangzb1@lenovo.com

查看指定的以太网接口 Receive 的量:

 ./nic_monitor -er ens3f0np0

如下是检测到的接受的网络流量:

查看指定的以太网接口 Send  流量:

  ./nic_monitor -es ens3f0np0

查看指定以太网接口 收和发 的流量

./nic_monitor -ea ens3f0np0

nic_monitor_v2.0_eth.py

nic_monitor_v2.0_eth.py 通过TUI界面实时显示以太网流量的工具,使用Python3编写的。

语法:

 nic_monitor_v2.0_eth.py [-h] [-i INTERFACE [INTERFACE ...]] [-a] [-v]

帮助信息:

# python3 nic_monitor_v2.0_eth.py -h

usage: nic_monitor_v2.0_eth.py [-h] [-a] [-i INTERFACE [INTERFACE ...]] [-v]

 

Ethernet Network Traffic Monitor with TUI, Author: Bob Pang , E-mail: pangzb1@lenovo.com

 

options:

  -h, --help            show this help message and exit

  -a, --all             Monitor all available interfaces

  -i INTERFACE [INTERFACE ...], --interface INTERFACE [INTERFACE ...]

                        Specify one or more interfaces to monitor

  -v, --version         show program's version number and exit

查看指定以太网接口流量

# python3 nic_monitor_v2.0_eth.py -i ens3f0np0

可以同时指定多个端口,以空格分隔

# python3 nic_monitor_v2.0_eth.py -i ens3f0np0 ens3f1np1

查看所有以太网接口流量

# python3 nic_monitor_v2.0_eth.py -a

nic_monitor_v2.1_rdma.py

查看指定的RDMA接口流量

# python3 nic_monitor_v2.1_rdma.py -i mlx5_1-1

如何知道我想查看的端口?

执行 ibdev2netdev 指令,可以查看网络接口对应的CA Name

查看所有RDMA接口流量

# python3 nic_monitor_v2.1_rdma.py