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
We need your assistance to stay live
This week Top Posts
- Grive: An Unofficial, Open Source Linux Client For Google Drive : A couple of months before, we have featured a Linux client for Google Drive named Syncdrive, which w...2 comments |
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX : Wow! Early last week it was all over the internet, if you haven't heard it yet then this is the t...2 comments |
- 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 |
- News from Kaspersky Lab: Tor is protecting criminals : In a previous article I wrote a bit about Tor. Free browser, relays bouncing your IP all over the ...1 comment |
- Install Sublime Text 3 In Fedora Easily With Fedy : Sublime Text is a sophisticated text editor for code, markup and prose. In this tutorial we are goi...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 |
- Adding and Deleting Cluster Resources (corosync pacemaker)
- News from Kaspersky Lab: Tor is protecting criminals
- Install Satis On Ubuntu Sever 13.10/13.04
- How To Access A LVM Drive / Partition in Ubuntu
- How To Disable Remember Open Files in Sublime Text 3
- Install Sublime Text 3 In Fedora Easily With Fedy
- Grive: An Unofficial, Open Source Linux Client For Google Drive
- Install nSnake Game In Terminal
- How To “Fix E: Could not open file /var/lib/dpkg/status”
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .