Install Bandwidth Monitor vnstat on Ubuntu

ubuntu

Now I am going to explain network monitoring tool which monitors bandwidth for a system, ie vnstat(view network statistics).

Its very much easy to install and configure.

To install vnStat on Ubuntu/Debian, you can use apt-get:

sudo apt-get install vnstat	

After installation completed, we can test vnstat

root@fwhwin:~# vnstat -d
 eth0: Not enough data available yet.
root@fwhwin:~# 

Don’t worry about error intitially it will show error because it’s the first time you are executing that command, so it has to create DB.

You can restart the vnStat daemon vnstatd with:


# /etc/init.d/vnstat restart
Starting vnStat daemon: vnstatd 

For monitoring traffic per day

root@fwhwin:~# vnstat -d

 eth0  /  daily

         day         rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
      08/28/14     15.46 MiB |    3.92 MiB |   19.38 MiB |    3.83 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        31 MiB |       6 MiB |      37 MiB |
root@fwhwin:~#


For monitoring traffic per hour

root@fwhwin:~# vnstat -h
 eth0                                                                     11:35 
  ^                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       r     
  |                                                                       rt    
  |                                                                       rt    
 -+---------------------------------------------------------------------------> 
  |  12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11    
                                                                                
 h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB) 
12          0          0    20          0          0    04          0          0
13          0          0    21          0          0    05          0          0
14          0          0    22          0          0    06          0          0
15          0          0    23          0          0    07          0          0
16          0          0    00          0          0    08          0          0
17          0          0    01          0          0    09          0          0
18          0          0    02          0          0    10          0          0
19          0          0    03          0          0    11      22550       5629
root@fwhwin:~# 


For monitoring traffic per month


# vnstat –m

We can check vnstat status by following command

root@fwhwin:~# sudo /etc/init.d/vnstat status
 * vnStat daemon is running
root@fwhwin:~# 

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.
Posted in Linux, Ubuntu