4 C
Texas

How To Install vnStat Network Traffic Monitoring Tool On Ubuntu 20.04

In this tutorail you’ll learn that how to install vnStat network monitoring tool on Ubuntu 20.04. vnStat is an open source tool that can be used to monitor the network resources of your system by using console. It allows you to customize the time for generating network traffic data. vnStat provides high service with low consumption of resources. So, here we’ll see the steps to instlal it on your system.

Step 1: Update Your System

First of all update your system to have the latest updates installed.

sudo apt update && sudo apt upgrade -y

Then reboot your system.

- Advertisement -
sudo reboot

Step 2: Install vnStat On Ubuntu 20.04

As the latest version of vnStat is not available on the Ubuntu repositories, so we’ll install it from the source code. Hit the below command to resolve the required dependencies.

sudo apt install build-essential gcc make libsqlite3-dev -y

After installing the above packages, get the latest version of vnStat using wget.

wget https://humdi.net/vnstat/vnstat-2.6.tar.gz

Then extract the downloaded file by typing

tar -xvzf vnstat-2.6.tar.gz

Now, switch to the resultant directory & configure it by typing

cd vnstat-2.6
./configure --prefix=/usr --sysconfdir=/etc

Finally hit the below command to instlal the vnStat on your system

sudo make
sudo make install

After the successfull installation, verify the installed version of vnStat by typing

vnstat -v

Output: You’ll see the similar output.

sabi@Ubuntu20:~/vnstat-2.6$ vnstat -v
vnStat 2.6 by Teemu Toivola

Step 3: Managing vnStat Service on Ubuntu 20.04

In order to add a systemd service for vnStat, simply copy the file from vnStat source to the /etc/systemd/system/ folder by typing

sudo cp -v vnstat-2.6/examples/systemd/vnstat.service /etc/systemd/system/

Run the given commands to start & enable the vnStat services.

systemctl enable vnstat
systemctl start vnstat

Make sure that vnStat is in working status by

sabi@Ubuntu20:~$ sudo systemctl status vnstat
● vnstat.service - vnStat network traffic monitor
Loaded: loaded (/etc/systemd/system/vnstat.service; disabled; vendor preset:>
Active: active (running) since Sat 2020-12-05 11:17:42 PKT; 5s ago
Docs: man:vnstatd(8)
man:vnstat(1)
man:vnstat.conf(5)
Main PID: 17791 (vnstatd)
Tasks: 1 (limit: 2285)
Memory: 1.4M
CGroup: /system.slice/vnstat.service
└─17791 /usr/sbin/vnstatd -n
دسمبر 05 11:17:42 Ubuntu20 systemd[1]: Started vnStat network traffic monitor.
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: No interfaces found in database, addin>
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: Interface "ens33" added with 1000 Mbit>
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: -> 1 new interface found.
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: Limits can be modified using the confi>
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: Unwanted interfaces can be removed fro>
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: Info: vnStat daemon 2.6 started. (pid:>
دسمبر 05 11:17:42 Ubuntu20 vnstatd[17791]: Info: Monitoring (1): ens33 (1000 Mbit)
lines 1-20/20 (END)

Step 4: Working with vnStat on Ubuntu 20.04

The most useful command for operating with vnStat is help command. You can see all the other options by typing this command.

vnstat --help

Output:

You’ve to wait for few minutes to use the vnstat because vnstat take some time to update the database. Once updated, you can use it easily by typing

vnstat

Output:

In order to specify the network interface type

vnstat -i ens3

Output:

In order to recieve hourly stats hit

vnstat -h

To get daily updates type

vnstat -d

In order to see the top traffic days hit

vnstat -t

To see the network traffic in real time type

vnstat -i

In order to clear the database & stop monitoring the interface type

sudo vnstat -i ens3 --remove --force

Output:

sabi@Ubuntu20:~$ sudo vnstat -i ens33 --remove --force
Interface "ens33" removed from database.
The interface will no longer be monitored. Use --add
if monitoring the interface is again needed.

To add the removed int again type

sudo vnstat -i ens3 --add

So, this is how you can install vnStat network monitoring tool on Ubuntu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article