Remark :
Ubuntu install vnstat console network traffic monitor
1. Install
1 2 3 |
yum install vnstat |
2. find out your interface name
1 2 3 4 |
ip l show ip a show |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$ ip l show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether b7:27:eb:45:12:b3 brd ff:ff:ff:ff:ff:ff 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DORMANT group default qlen 1000 link/ether b8:27:eb:10:47:e6 brd ff:ff:ff:ff:ff:ff $ ip a show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b7:27:eb:45:12:b3 brd ff:ff:ff:ff:ff:ff inet 192.168.1.128/24 brd 192.168.1.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::3527:7396:9dfe:6517/64 scope link valid_lft forever preferred_lft forever 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b7:27:eb:10:47:e6 brd ff:ff:ff:ff:ff:ff |
3. Configuration
1 2 3 |
vi /etc/vnstat.conf |
1 2 3 |
Interface "enp0s31f6" => Interface "eth0" |
4. A new database create / vnstat –create -i eth0
1 2 3 |
$ vnstat --create -i eth0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ vnstat -d No database found, nothing to do. Use --help for help. A new database can be created with the following command: vnstat --create -i eth0 Replace 'eth0' with the interface that should be monitored. The following interfaces are currently available: eth0 lo $ vnstat --create -i eth0 |
5. Now, make vnstat daemon auto start at boot
1 2 3 4 |
sudo systemctl start vnstat.service sudo systemctl enable vnstat.service |
6. check / vnstat -h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$ vnstat -hg eth0 10:49 ^ t | t | t | t | t | t | r t t | r t t | r r r r r t t | rt r r r r r r rt rt -+---------------------------------------------------------------------------> | 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 h rx (KiB) tx (KiB) ][ h rx (KiB) tx (KiB) ][ h rx (KiB) tx (KiB) 11 18 5 ][ 19 23 3 ][ 03 32 3 12 31 5 ][ 20 101 9 ][ 04 20 3 13 27 4 ][ 21 230 17 ][ 05 28 3 14 61 51 ][ 22 131 15 ][ 06 25 5 15 48 7 ][ 23 106 15 ][ 07 44 6 16 19 4 ][ 00 109 11 ][ 08 43 10 17 21 4 ][ 01 25 3 ][ 09 90 470 18 17 3 ][ 02 24 3 ][ 10 71 216 |
issue: . Not enough data available yet.
1 2 3 4 5 |
$ sudo chown vnstat:vnstat -R /var/lib/vnstat/* $ sudo chmod 777 -R /var/lib/vnstat/* |