Tuesday 26 March 2013

thumbnail

How to monitor network bandwidth usage on ubuntu-12.04

How to monitor network bandwidth usage on ubuntu-12.04



If you are using limited internet connection and you want to monitor the bandwidth usage then here it is a tool to keep track of it.

vnstat:-
 It is a software tool to monitor you network bandwith

vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). However, isn't a packet sniffer. The traffic information is analyzed from the proc(5) and  sys  filesystems depending on availability. That way vnStat can be used even without root permissions on most systems.  

How to install vnstat in Ubuntu.

1. Open the terminal and type 

$ sudo apt-get install vnstat






2.  Then restart the vnstat service.

$ sudo service vnstat restart

3.  Then try to download some package by using internet like this.

$ sudo apt-get download eclipse.

4. Now check the vnstat data.

$ vnstat


5. If you want to check the status for daily basis than do this.

$ vnstat -i eth0 -d

6. If you want to check the monthly stats then do this.

$ vnstat -i eth0 -m

     
7. If you want to check the stats hourly then do this.

$ vnstat -i eth0 -h

8.  Please change the "eth0 according to your network interface. To check the list of interface you can do this.

$ vnstat --iflist

9. If you have multiple interface and you want to monitor other interface like eth1. then edit /etc/vnstat.conf file. And change the default interface from eth0 to eth1. like this.

# default interface 
Interface "eth0"        ---------> eth1


  10.  You can also graphically monitor it by using vnstat php fronend. You have to download the package from outside and you require php5 and apache2 installed.

$ wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz   

11.  Extract the file.

$ tar xvf vnstat_php_frontend-1.5.1.tar.gz

12. Put all the the contents into /var/www/vnstat directory

$ sudo mkdir /var/www/vnstat

13. Move all your content vnstat_php_frontend to /var/www/vnstat directory.

$ sudo mv vnstat_php_frontend-1.5.1/* /var/www/vnstat/

14.Edit the config file and set the correct binary name.

$ sudo vim /var/www/vnstat/config.php

$vnstat_bin = 'vnstat';



15. Change the ownership permission.

$ sudo chown -R www-data:www-data vnstat/
$ sudo service apache2 restart

16. Now try to open in the browser.

 
Note:- If you have single interface than you have to look into interals if you have multiple interface then you have decide which interface you want to monitor and set in vnstat.conf file.

That's it you can enjoy monitoring stats. 

    

Subscribe by Email

Follow Updates Articles from This Blog via Email

8 Comments

avatar

Very Informative! This blog is great source of information which is very useful for me. Thank you very much for sharing this!OpenSpeedTestt

Reply Delete
avatar

Great blog with great picture. Thanks for sharing this post....Network Traffic Monitoring Software

Reply Delete
avatar

Network bandwidth monitoring is certainly a essential activity of an enterprise multilevel administrator.

Reply Delete
avatar

Without the correct network performance monitoring tools, your job as a network administrator becomes more cumbersome...Network Bandwidth Monitoring Tool

Reply Delete
avatar

The most bandwidth, what applications are causing network congestion, where the traffic is going, at what time and a lot more. From there you can interactively drill down to get more detailed information by conversation, user, application, class of service, traffic volume and bandwidth.
Network Bandwidth Monitoring Tool

Reply Delete