Tutorial details | |
---|---|
Difficulty | Intermediate (rss) |
Root privileges | Yes |
Requirements | Apache 2.x+ / PHP 5.x+ CentOS/ SL / Fedora/ RHEL |
Time | N/A |
[a] Apache
[b] PHP 5
[c] php-gd extension
You can install all of the above softwares using the yum command:
# yum install httpd php php-gd
Configure httpd service as per your requirements:
# vi /etc/httpd/conf/httpd.conf
Turn on the httpd service:
# chkconfig httpd on
# service httpd start
# netstat -tulpn | grep :80
Download vnStat php frontend
Visit this url and grab the latest version using the wget command:
$ cd /tmp
$ wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
Untar or extract the tarball (tar file) called vnstat_php_frontend-1.5.1.tar.gz, type:
$ tar xvf vnstat_php_frontend-1.5.1.tar.gz
Install vnStat php frontend
You need to install this frontend at the following location:
/var/www/html/vnstat/
Make a directory called /var/www/html/vnstat/ using mkdir command:
# mkdir -p /var/www/html/vnstat/
Copy files from /tmp/vnstat_php_frontend-1.5.1 to /var/www/html/vnstat using cp command, enter:
# cp -av /tmp/vnstat_php_frontend-1.5.1/* /var/www/html/vnstat
If you are using SELinux, restore file(s) default SELinux security contexts using restorecon command:
# restorecon -Rv /var/www/html/vnstat/
Configure vnStat php frontend
You need to edit /var/www/html/vnstat/config.php, enter:
# vi /var/www/html/vnstat/config.php
You need to edit this file to reflect your particular situation. First, set language to en:
$language = 'en';
I am monitoring eth0 and eth1. So list of network interfaces monitored by vnStat should be set using the following:
$iface_list = array('eth0', 'eth1');
You can set names for interfaces:
$iface_title['eth0'] = 'Internal'; $iface_title['eth1'] = 'External';
Save and close the file.
How do I view graphs?
Fire a web browser and type the url:
http://your-server-ip-address-here/vnstat/ http://localhost/vnstat/ http://server1.cyberciti.biz/vnstat/ http://192.168.1.100/vnstat/
Sample outputs:
Check out related media
This tutorial is also available in a video format:
(Video.01: Demo: Setup and use vnStat )
- How to install vnstat on a CentOS/RHEL/Fedora Linux
- View Vnstat Graphs Using PHP Web Interface Frontend
- How to install vnstat on FreeBSD Unix server
- Fedora Linux install vnstat network traffic monitor
- Ubuntu install vnstat console network traffic monitor
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 6 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi,
Thanks….
very nice article…
Nice tool for customers meetings :-)
This blog has great essence of technical knowledge. This is awesome. Thanx for penning down your experience. Thanx once again. I’ve been reading many web hosting blogs, web development blogs, but I believe this one stands tall.
i will try on my vps.. and i will share
thanks for inspiration
This works flawlessly. Thank you for your excellence.
Might want to make sure you have your date.timezone set correctly in /etc/php.ini
http://us3.php.net/manual/en/datetime.configuration.php#ini.date.timezone
For example,
date.timezone = “America/Los_Angeles”