Vnstat is a Console-based network traffic monitor for Linux.It keep a log of hourly, daily and monthly network traffic for the selected Interface.
First we need to install EPEL repo then type below command.
[root@localhost ~]# yum install vnstat
Loaded plugins: etckeeper, fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink | 21 kB 00:00
* base: mirror.checkdomain.de
* epel: mirrors.n-ix.net
* extras: mirror.checkdomain.de
* rpmforge: mirror.jgotteswinter.com
* updates: mirror.checkdomain.de
base | 3.7 kB 00:00
epel | 4.2 kB 00:00
epel/primary_db | 5.1 MB 00:00
extras | 3.5 kB 00:00
rpmforge | 1.9 kB 00:00
updates | 3.5 kB 00:00
updates/primary_db | 2.1 MB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vnstat.x86_64 0:1.11-1.el6.rf will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================
Package Arch Version Repository
======================================================================
Installing:
vnstat x86_64 1.11-1.el6.rf rpmforge
Transaction Summary
======================================================================
Install 1 Package(s)
Total download size: 59 k
Installed size: 139 k
Is this ok [y/N]: y
Downloading Packages:
vnstat-1.11-1.el6.rf.x86_64.rpm | 59 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
etckeeper: pre transaction commit
[master c211840] saving uncommitted changes in /etc prior to yum run
Author: manivel <manivel@iitb-st>
3 files changed, 2 insertions(+), 3 deletions(-)
delete mode 100644 vnstat.conf
Installing : vnstat-1.11-1.el6.rf.x86_64 1/1
etckeeper: post transaction commit
Verifying : vnstat-1.11-1.el6.rf.x86_64 1/1
Installed:
vnstat.x86_64 0:1.11-1.el6.rf
Complete!
Another Method
Installation:
First we need to install EPEL repo then type below command.
[root@localhost ~]# yum install vnstat
Loaded plugins: etckeeper, fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink | 21 kB 00:00
* base: mirror.checkdomain.de
* epel: mirrors.n-ix.net
* extras: mirror.checkdomain.de
* rpmforge: mirror.jgotteswinter.com
* updates: mirror.checkdomain.de
base | 3.7 kB 00:00
epel | 4.2 kB 00:00
epel/primary_db | 5.1 MB 00:00
extras | 3.5 kB 00:00
rpmforge | 1.9 kB 00:00
updates | 3.5 kB 00:00
updates/primary_db | 2.1 MB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vnstat.x86_64 0:1.11-1.el6.rf will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================
Package Arch Version Repository
======================================================================
Installing:
vnstat x86_64 1.11-1.el6.rf rpmforge
Transaction Summary
======================================================================
Install 1 Package(s)
Total download size: 59 k
Installed size: 139 k
Is this ok [y/N]: y
Downloading Packages:
vnstat-1.11-1.el6.rf.x86_64.rpm | 59 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
etckeeper: pre transaction commit
[master c211840] saving uncommitted changes in /etc prior to yum run
Author: manivel <manivel@iitb-st>
3 files changed, 2 insertions(+), 3 deletions(-)
delete mode 100644 vnstat.conf
Installing : vnstat-1.11-1.el6.rf.x86_64 1/1
etckeeper: post transaction commit
Verifying : vnstat-1.11-1.el6.rf.x86_64 1/1
Installed:
vnstat.x86_64 0:1.11-1.el6.rf
Complete!
[root@localhost ~]#
Another Method
Vnstat is not found the repositories.You can download and install
[root@localhost ~]# wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
[root@localhost ~]# tar -xzvf vnstat-1.11.tar.gz
[root@localhost ~]# cd vnstat-1.11
[root@localhost ~]# make && make install
[root@localhost ~]# wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
[root@localhost ~]# tar -xzvf vnstat-1.11.tar.gz
[root@localhost ~]# cd vnstat-1.11
[root@localhost ~]# make && make install
Configuration
You need to tell it to setup the database for your network interface. Replace eth0 with the correct interface. ( you can check your network interface using this command "ifconfig").
[root@localhost ~]# vim /etc/sysconfig/vnstat
VNSTAT_OPTIONS="-u -i eth0"
: wq
Vnstat updates its statistics automatically every 5 minutes via a cron job.By default assigned incorrect permissions. So edit the cron file
[root@localhost ~]# vim /etc/cron.d/vnstat
MAILTO=root
*/5 * * * * root /usr/sbin/vnstat.cron
: wq
How to use Vnstat
Common Vnstat use
[root@localhost ~]# vnstat
Hourly report
[root@localhost ~]# vnstat -h
Daily Report
[root@localhost ~]# vnstat -d
Weekly Report
[root@localhost ~]# vnstat -w
Monthly Report
[root@localhost ~]# vnstat -m
Live Monitoring
[root@localhost ~]# vnstat -l
I fully agree with your views. Thanks for sharing your points.These are really helpful to all. Network Traffic Monitoring
ReplyDelete