Track Network Traffic with vnStat on CentOS: Installation and Setup

Track Network Traffic with vnStat on CentOS: Installation and Setup


vnStat is a lightweight network bandwidth monitoring tool that helps track network traffic on your server's interfaces. Here's a quick guide to installing and configuring vnStat on CentOS.

Step 1: Install vnStat

yum -y install epel-release yum -y install vnstat

Step 2: Edit Network Configuration (If Needed)

Edit the config file to specify the interface:

nano /etc/vnstat.conf

Step 3: Create Database for Monitoring

Initialize the database for the network interface:

vnstat -u -i eth0 chown vnstat:vnstat /var/lib/vnstat/eth0

Step 4: Start vnStat Service

systemctl start vnstat systemctl enable vnstat

Step 5: Monitor Network Traffic



  • Hourly: vnstat -h
  • Daily: vnstat -d
  • Weekly: vnstat -w
  • Monthly: vnstat -m
  • Real-time: vnstat -l
  • Generate graph: vnstati -vs -i ens192 -o /tmp/vnstat.png
  • Generate graph (> 1 Card): vnstati -vs -i ens192+eth0+... -o /tmp/vnstat.png

Conclusion

vnStat offers an efficient way to track network bandwidth usage on your CentOS system.

Post a Comment

Previous Post Next Post