2019-11-16-Linux流量检测工具-vnstat使用

安装

yum install epel-release -y && yum install -y vnstat

为指定网卡创建监控数据库

vnstat -u -i eth0 #网卡名,使用 ip a查看

流量查看命令

vnstat -d  #每日统计
vnstat -m  #每月统计

实时监控

vnstat -l -i eth0
Monitoring eth0...    (press CTRL-C to stop)

   rx:        4 kbit/s     7 p/s          tx:       58 kbit/s     4 p/s^C


 eth0  /  traffic statistics

                           rx         |       tx
--------------------------------------+------------------
  bytes                    13.55 MiB  |       13.96 MiB
--------------------------------------+------------------
          max            7.88 Mbit/s  |     9.07 Mbit/s
      average          740.06 kbit/s  |   762.33 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
  packets                       4634  |            5691
--------------------------------------+------------------
          max                354 p/s  |         466 p/s
      average                 30 p/s  |          37 p/s
          min                  0 p/s  |           0 p/s
--------------------------------------+------------------
  time                  2.50 minutes