如何获取 TB 范围内的 ubuntu 网络接口统计数据?

如何获取 TB 范围内的 ubuntu 网络接口统计数据?

ifconfig当我使用或查询服务器的网络接口统计信息时,ip -s它们被限制为 999GB,然后滚动到 0GB,重新开始。是否可以以某种方式更改配置以允许在 TB 范围内记录统计信息?或者使用其他日志记录工具?我正在使用 Ubuntu 20.04。

$ uname -p
x86_64

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

非常感谢。

编辑以添加所需信息。enp4s0是我的防火墙的 LAN 端,总数最近才重置回 0GB。我会适时提供更新。

ifconfig 输出:

$ ifconfig enp4s0
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.54.141  netmask 255.255.255.0  broadcast 192.168.54.255
        ether 00:26:2d:24:91:43  txqueuelen 1000  (Ethernet)
        RX packets 47559414  bytes 8105358582 (8.1 GB)
        RX errors 0  dropped 9  overruns 0  frame 0
        TX packets 126168339  bytes 183503412184 (183.5 GB)
        TX errors 1  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 18

ip 输出:

$ ip -s -h link show enp4s0
4: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:26:2d:24:91:43 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    8.11G      47.6M    0       9       0       3.38k
    TX: bytes  packets  errors  dropped carrier collsns
    184G       126M     1       0       0       0

答案1

ifconfig和都ip根据要显示的数据量以适当的单位显示统计数据。您能提供显示单位翻转前后的输出吗?

以下是 Ubuntu 16.04.4 x86_64 服务器的输出:

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

$ uname -p
x86_64

ifconfig 输出

$ ifconfig enp94s0f1
enp94s0f1 Link encap:Ethernet  HWaddr 28:ac:9e:e7:a9:cd  
          inet addr:196.196.195.10  Bcast:196.196.195.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11694856562 errors:0 dropped:38446 overruns:0 frame:0
          TX packets:10658263823 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6448839112903 (6.4 TB)  TX bytes:4392568782445 (4.3 TB)

ip 输出

$ ip -s -h link show enp94s0f1
3: enp94s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 28:ac:9e:e7:a9:cd brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    6.45T      11.7G    0       38.4k   0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    4.39T      10.7G    0       0       0       0 

相关内容