1. Install and configure Local Yum Repository from CD-ROM/DVD-ROM image and EPEL Repository as per below posts :
How to Install and Configure EPEL Repository on CentOS 6.2
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2
How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2
2. Install vnStat using yum command :
[root@centos62 ~]# yum install vnstat -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.hostemo.com
* epel: ftp.riken.jp
* extras: mirrors.hostemo.com
* updates: ossm.utm.my
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vnstat.i686 0:1.11-1.el6 will be installed
--> Processing Dependency: libgd.so.2 for package: vnstat-1.11-1.el6.i686
--> Running transaction check
---> Package gd.i686 0:2.0.35-10.el6 will be installed
--> Processing Dependency: libXpm.so.4 for package: gd-2.0.35-10.el6.i686
--> Running transaction check
---> Package libXpm.i686 0:3.5.8-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package Arch Version Repository Size
====================================================================================================
Installing:
vnstat i686 1.11-1.el6 epel 104 k
Installing for dependencies:
gd i686 2.0.35-10.el6 CentOS6.2-Repository 141 k
libXpm i686 3.5.8-2.el6 CentOS6.2-Repository 58 k
Transaction Summary
====================================================================================================
Install 3 Package(s)
Total download size: 304 k
Installed size: 944 k
Downloading Packages:
(1/3): vnstat-1.11-1.el6.i686.rpm | 104 kB 00:00
----------------------------------------------------------------------------------------------------
Total 227 kB/s | 304 kB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libXpm-3.5.8-2.el6.i686 1/3
Installing : gd-2.0.35-10.el6.i686 2/3
Installing : vnstat-1.11-1.el6.i686 3/3
Installed:
vnstat.i686 0:1.11-1.el6
Dependency Installed:
gd.i686 0:2.0.35-10.el6 libXpm.i686 0:3.5.8-2.el6
Complete!
3. Start the vnStat service :
[root@centos62 ~]# service vnstat start
Starting vnstatd: [ OK ]
4. To ensure that vnStat is started at boot time, you can execute a chkconfig command as below :
[root@centos62 ~]# chkconfig vnstat on
5. Execute command “vnstat –iflist” to display the available network interface :
[root@centos62 ~]# vnstat --iflist
Available interfaces: lo eth0
6. Before vnStat can begin logging the bandwidth usage, it is necessary to setup the database for your network interface. Kindly replace the “eth0″ with the correct interface if you running multiple interface :
[root@centos62 ~]# vnstat -u -i eth0
7. View the first vnStat data :
[root@centos62 ~]# vnstat
Database updated: Thu Mar 8 20:41:00 2012
eth0 since 03/08/12
rx: 75 KiB tx: 73 KiB total: 148 KiB
monthly
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
Mar '12 75 KiB | 73 KiB | 148 KiB | 0.00 kbit/s
------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
daily
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
today 75 KiB | 73 KiB | 148 KiB | 0.02 kbit/s
------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
8. View vnStat bandwidth statistic by day :
[root@centos62 ~]# vnstat -d
eth0 / daily
day rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
03/08/12 75 KiB | 73 KiB | 148 KiB | 0.02 kbit/s
------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
9. View vnStat bandwidth statistic by hour :
[root@centos62 ~]# vnstat -h
eth0 20:41
^ r
| rt
| rt
| rt
| rt
| rt
| rt
| rt
| rt
| rt
-+--------------------------------------------------------------------------->
| 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
h rx (KiB) tx (KiB) h rx (KiB) tx (KiB) h rx (KiB) tx (KiB)
21 0 0 05 0 0 13 0 0
22 0 0 06 0 0 14 0 0
23 0 0 07 0 0 15 0 0
00 0 0 08 0 0 16 0 0
01 0 0 09 0 0 17 0 0
02 0 0 10 0 0 18 0 0
03 0 0 11 0 0 19 0 0
04 0 0 12 0 0 20 75 73
10. Update the vnStat database :
[root@centos62 ~]# vnstat -u
11. View vnStat help and other available command :
[root@centos62 ~]# vnstat --help
vnStat 1.11 by Teemu Toivola
-q, --query query database
-h, --hours show hours
-d, --days show days
-m, --months show months
-w, --weeks show weeks
-t, --top10 show top10
-s, --short use short output
-u, --update update database
-i, --iface select interface (default: eth0)
-?, --help short help
-v, --version show version
-tr, --traffic calculate traffic
-ru, --rateunit swap configured rate unit
-l, --live show transfer rate in real time
See also "--longhelp" for complete options list and "man vnstat".
As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below.
0 comments:
Post a Comment