You will need, and it is important to monitor network traffics if you are running server.

Here we will use simple and light tool, vnstat.

vnstat Developer Website : http://humdi.net/vnstat/

0. Install Package

$ sudo apt install -y vnstat

1. Change permission for folder and files for automatic update

Once you complete installation, there is a config file at /etc/vnstat.conf, and vnstat creates database at /var/lib/vnstat/.<em>interface name</em>

You can find vnstat database updates automatically every 5 minutes, in config file.

However, it does not update. This is because of the root user owns database file.

So, you will need to change ownership for database file with following command:

$ sudo chown -R vnstat:vnstat /var/lib/vnstat

It will automatically update database every 5 minutes, once you change ownership.

1-1.Update database manually

If you update database immediately, use following command:

$ sudo vnstat -u

2. Watch network traffic data

For watching network traffic data, use following command

$ vnstat

This includes updated data at last updated point since you installed vnstat.

3. vnstat option

There are many query option for vnstat data.

$ vnstat --help

then you will see following options.

-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top10
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time

For example, if you want to watch data by hours, use following command,

$ vnstat -h

4. Live mode

vnstat supports live mode, too. You can watch live network traffic by following command:

$ vnstat -l

Exit with Ctrl + c

— layout: post title: ‘VNSTAT’ date: 2016-04-25 22:30:00 +0900 image: ‘/assets/img/’ description: “Simple way to network traffic amount monitoring tool” tags: - Linux categories: twitter_text: —

You will need, and it is important to monitor network traffics if you are running server.

Here we will use simple and light tool, vnstat.

vnstat Developer Website : http://humdi.net/vnstat/

0. Install Package

$ sudo apt install -y vnstat

1. Change permission for folder and files for automatic update

Once you complete installation, there is a config file at /etc/vnstat.conf, and vnstat creates database at /var/lib/vnstat/.<em>interface name</em>

You can find vnstat database updates automatically every 5 minutes, in config file.

However, it does not update. This is because of the root user owns database file.

So, you will need to change ownership for database file with following command:

$ sudo chown -R vnstat:vnstat /var/lib/vnstat

It will automatically update database every 5 minutes, once you change ownership.

1-1.Update database manually

If you update database immediately, use following command:

$ sudo vnstat -u

2. Watch network traffic data

For watching network traffic data, use following command

$ vnstat

This includes updated data at last updated point since you installed vnstat.

3. vnstat option

There are many query option for vnstat data.

$ vnstat --help

then you will see following options.

-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top10
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time

For example, if you want to watch data by hours, use following command,

$ vnstat -h

4. Live mode

vnstat supports live mode, too. You can watch live network traffic by following command:

$ vnstat -l

Exit with Ctrl + c