Installing vnStat on Centos 7

vnStat is a low overhead simple tool useful for tracking the send / receive (RX/TX) of any given network adapter attached to your system.  I use it periodically to track several of my server’s bandwidth utilization.  In addition, I have also configured my bashrc file to display vnStat statistics at login after the output from Neofetch.  Output from vnStat looks similar to the following:

vnStat Output Example
vnStat Output Example


  • Statistics remain available even after system reboots
  • Monitor multiple network interfaces at the same time
  • Multiple output options
  • Sort the data by hour, day, month, week or get the top 10 days
  • Generate png graphic of the output
  • Configure “Months” to follow up with different billing cycles you may have
  • Very light – consumes really small portion of your system resources
  • Low CPU usage no matter how much traffic you generate
  • You don’t have to be root to use it
  • Select units dynamically (KB, MB etc)
  • vnStati provides some new options like:
    • -nl / –nolegend (hides the rx/tx legend)
    • –altdate – use alternative date/time text location
    • –headertext – to customize the text in the image header.
  • You can add legend to generated output image
  • Customizable options for content positioning and image background color to vnStat.cgi.
  • The interface bandwidth will be automatically detected.
  • Use JSON for output

In order to install VnStat, you have to enable EPEL repositories package for your version of Linux.

Next, perform the following:

yum -y install vnstat
systemctl start vnstat
systemctl enable vnstat
chkconfig vnstat on
service vnstat status

vnStat can be configured for all or just some of the NIC’s in your system.  After accumulating some data, it will present a similar output as above.  If you notice after installing the application that it is not updating data or displaying any output, you may need to adjust permissions as such:

chown -R vnstat:vnstat /var/lib/vnstat

About the author

Lima is the visual nautical indicator for "stop instantly."

Leave a Reply