vnStat PHP: A Graphical Frontend for vnStat Network Bandwidth Monitoring Tool
We have already shown you how to install and monitor network interface bandwidth usage using vnStat in our previous article. Since vnStat command is only command mode, the author of vnStat have created cool Graphical PHP frontend called vnStat PHP frontend to view vnStat graphs. You can view the network interfaces bandwidth usages in you browser itself. I must thank Unixmen Reader Padhu for mentioning this tool. Well, let us see how to install and configure vnStat PHP frontend utility.
Before proceed, vnStat tool should be properly installed and should collect network statistics. To know more about installaing and Monitoring vnStat tool, refer our previous article here.
And you have to install Apache, PHP and php-gd extension. Enter the following command to install them.
$ sudo apt-get install apache2 php5 php5-gd
$ yum install httpd php php-gd -y
Start Apache service.
$ sudo /etc/init.d/apache2 start
$ service httpd start $ chkconfig httpd on
Getting vnStat PHP
Download vnStat PHP tool using the following command:
$ wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
Extract it using command:
$ tar xvf vnstat_php_frontend-1.5.1.tar.gz
It will be extracted as folder vnstat_php_frontend-x.x.x in your current directory. Copy the contents of the folder to web server root folder as shown below.
$ sudo cp -fr vnstat_php_frontend-1.5.1/ /var/www/vnstat
$ sudo cp -fr vnstat_php_frontend-1.5.1/ /var/www/html/vnstat
Open vnStat PHP config.php file.
$ sudo vi /var/www/vnstat/config.php
$ sudo vi /var/www/html/vnstat/config.php
Set your language:
[...] // edit these to reflect your particular situation // $locale = 'en_US.UTF-8'; $language = 'en'; [...]
Enter you network interfaces to be monitored. In my case I am monitoring eth0 and eth1:
[...] // list of network interfaces monitored by vnStat $iface_list = array('eth0', 'eth1'); [...]
Save and exit the file.
Allow apache port 80 through your firewall/router.
If you are using Ubuntu/Debian systems, run the following command:
$ sudo ufw allow 80
If you are using CentOS/RHEL:
# vi /etc/sysconfig/iptables
Add the following line.
[...] -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT [...]
# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
Save and exit the file. Reboot your system.
Navigate to http://localhost/vnstat or http://ip-address/vnstat from your web browser. Now you will able to see the network graphs as shown below.
Click on the link hours in the left pane, you’ll be able to view the usage in hourly basis.
Also you can set the names for your network interfaces. To do so, open config.php file and edit as shown below.
[...] // optional names for interfaces // if there's no name set for an interface then the interface identifier // will be displayed instead // $iface_title['eth0'] = 'Internal'; $iface_title['eth1'] = 'External'; [...]
You can define your own names. Now refresh the page. You will see that the network interfaces names has been changed.
Thats it. Enjoy!!!
Like us on Facebook
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Manage Databases And Hosted Servers Remotely With DbNinja : Database administration via command line is bit difficult for newbie system and database administrat...0 comments |
- Setup IT And Asset Management System With GLPI On Debian/Ubuntu : GLPI is the Information Resource-Manager with an additional Administration Interface. You can use it...0 comments |
- How To Configure Linux Clients To Authenticate Using OpenLDAP : This is the continuation of our previous tutorial. In our previous tutorial we learned how to instal...0 comments |
- Install FrostWire 5.6.9 In Elementary OS 'Luna'/ Ubuntu / Linux Mint : FrostWire is a peer-to-peer file sharing program for the gnutella and BitTorrent protocols. FrostWir...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- How To Install Linux Kernel 3.12.4 In Ubuntu
- Firefox 26 Has Been Released, How To Install It In Ubuntu And Its Derivates
- How To Install Brasero In Elementary OS ‘Luna’
- Install Sayonara Player In Elementary OS / Ubuntu / Linux Mint
- Manage Databases And Hosted Servers Remotely With DbNinja
- Install FrostWire 5.6.9 In Elementary OS ‘Luna’/ Ubuntu / Linux Mint
- Setup IT And Asset Management System With GLPI On Debian/Ubuntu
- How To Configure Linux Clients To Authenticate Using OpenLDAP
- How To Install Netflix In Ubuntu
- cowsay And fortune Combined Together
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .