CentOS / RHEL: Install vnStat Network Traffic Monitor To Keep a Log Of Daily Traffic

To install vnStat, a network traffic monitor, on CentOS or RHEL, you can use the following steps:

  1. Install the vnstat package:
sudo yum install vnstat
  1. Start the vnstat daemon and enable it to start automatically at boot time:
sudo systemctl start vnstat
sudo systemctl enable vnstat
  1. Create a database for the desired network interfaces:
sudo vnstat --create -i <interface>

Replace <interface> with the name of the interface you want to monitor (e.g., eth0).

  1. Check the vnstat status:
sudo vnstat -u
  1. Display the current network traffic statistics:
sudo vnstat

By default, vnStat keeps a log of daily traffic. You can display the traffic statistics for specific days, months, or years by using the vnstat command with the appropriate options.

Leave a Comment