How to Install vnStat Network traffic monitor On Centos 7

What is vnStat, vnStat is console base network traffic monitor for linux and BSD. vnstat have a view features like :
  • gathered statistics persists through system reboots 
  • can monitor multiple interfaces at the same time  
  • several output options 
  • etc
Now we will discuss how to install it on CentOS 7 :
  • install epel repositories and enable it
rpm -Uvh
 yum -y install epel-release
  •  install vnStat trough yum
yum -y install vnstat nano
  •  as default vnstat will monitoring on eth0 if you want to change cou can change it on this files
nano /etc/sysconfig/vnstat
nano /etc/vnstat.conf
  • create vnstat databese an change owner the database
vnstat -u -i eth0
chown vnstat:vnstat /var/lib/vnstat/eth0
  •  run vnstat and start vnstat as service
service vnstat start
 chkconfig vnstat on
  • look the traffic uisng 
vnstat -d
  • vnstat option
    • -d : Show traffic for days
    •  -m : Show traffic for months
    • -t : Show traffic for top10
    • -h : Show traffic for the last 24 hours.
    • -w : Show traffic for 7 days, current and previous week