How to Install vnStat and vnStat Monitor Network Traffic on CentOS/RHEL 7 & Fedora 25 - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Monday, October 21, 2019

How to Install vnStat and vnStat Monitor Network Traffic on CentOS/RHEL 7 & Fedora 25






VnStat is a console based network traffic monitoring tool design for Linux and BSD.
1. It will keep a log of the network traffic for a selected network interface/s.
2. To generate the logs, vnStat uses the information provided by the kernel.
3. In other words it will not sniff the network traffic and will ensue the lite usage of the system resource.
4. To use this software under Linux you will need at least version 2.2 of the kernel series.

Features
1. Statistics remain available even after system reboots.
2. Monitor multiple network interfaces at the same time
3. Multiple output options.
4. Sort the data by hour, day, month, week or get the top 10 days
5. Generate png graphic of the output
6. Configure “Months” to follow up with different billing cycles you may have
7. Very light – consumes really small portion of your system resources
8. Low CPU usage no matter how much traffic you generate
9. You don’t have to be root to use it
10. Select units dynamically (KB, MB etc)
11. 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.
12. You can add legend to generated output image
13. Customizable options for content positioning and image background color to vnStat.cgi.
14. The interface bandwidth will be automatically detected.
15. Use JSON for output

Installing vnStat and vnStati Network Monitoring Tools on RHEL / CentOS / Fedora

Website :- http://humdi.net/vnstat/


1.  Downloading vnStat (Logging with root)
Step1 :-  wget http://humdi.net/vnstat/vnstat-1.13.tar.gz
Step2 :-  tar -xvf vnstat-1.13.tar.gz
Step3 :-  cd vnstat-1.13/
Step4 :-  make

Note :- if  gcc error came then install this
yum groupinstall "Development tools“

Step5 :-  make install

2.  Create a new database
Step6 :- var/lib/vnstat    or   vnstat

3.  If it is missing you can create
Step7 :- mkdir /var/lib/vnstat

create a new database
Step8 :-  vnstat --create  -i    eth0  ----   (to check eth0 ifconfig –a)
Step9 :-  /etc/vnstat.conf     ---- (If you wish to customize your vnStat configuration)

To see the network stats or hourly stats
Step10 :- vnstat    
Step11 :- vnstat -h   ---  (For Hourly stats)
Step12 :- vnstat -d    ---  (For Daily stats)
Step13 :- vnstat --help


To make the stats easier to read you can use the vnStati tool to generate .png images for vnStat
Step14 :- vnstati -s -i eth0 -o ~/network-log.png
Step15 :- vnstati -h -i eth0 -o ~/network-log.png