User Tools

Site Tools


vnstat

Installing vnstat

vnstat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). The traffic information is analyzed from the proc filesystem. That way vnStat can be used even without root permissions.

First you will need to install the epel repository
You can then install the tool with

yum install vnstat

You will then need to create a database for the tool:
Create the user first:
chsh -s /bin/bash vnstat
Create the database:
runuser -l vnstat -g vnstat -c '/usr/bin/vnstat -u -i eth0'
Once this has been done we will remove shell access for the user:
chsh -s /sbin/nologin vnstat

Stats overview

Value Description
rx Total Received
tx Total Transmitted


vnstat -i eth0

Example:
Database updated: Mon Feb 29 12:31:07 2016

   eth0 since 02/26/16

          rx:  2.52 GiB      tx:  2.55 GiB      total:  5.07 GiB

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
       Feb '16      2.52 GiB |    2.55 GiB |    5.07 GiB |   17.25 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated      2.56 GiB |    2.59 GiB |    5.15 GiB |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     yesterday      7.09 MiB |   12.27 MiB |   19.36 MiB |    1.84 kbit/s
         today     17.47 MiB |   10.33 MiB |   27.81 MiB |    5.05 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        32 MiB |      19 MiB |      51 MiB |


Daily Stats

vnstat -i eth0 -d

Example output:
         day         rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
      02/26/16      1.12 GiB |    1.14 GiB |    2.26 GiB |  219.79 kbit/s
      02/27/16      1.37 GiB |    1.39 GiB |    2.76 GiB |  267.79 kbit/s
      02/28/16      7.09 MiB |   12.27 MiB |   19.36 MiB |    1.84 kbit/s
      02/29/16     17.41 MiB |   10.16 MiB |   27.57 MiB |    5.08 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated        33 MiB |      19 MiB |      52 MiB |

Real time view

vnstat -i eth0 -l

vnstat.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1