Server network statistics

When you build a network, over time this network will grow. This is why it’s important to keep statistics. So you can expand before you run out of space or bandwidth.

Under Linux there are a few ways to do this. One of them I’m going to explain today.

The program I’ve found on the internet doesn’t do anything more than monitor your network traffic. The program runs under every Linux distribution.

At the beginning of this tutorial I would like to say that this is just a basic tool. Later on I will provide a detailed tool that uses snmp to make statistics.

In this tutorial I’m going to demonstrate how you can install vnStat under Debian 6.0.


  • A Debian server
  • Apache 2.2
  • PHP 5


To install vnStat under Debian you just have to type in to following command.

apt-get install vnstat

with the ifconfig -a command you will see all your network interfaces. Lets remember them for later. We will need them to make a database for the Ethernet controller.

root@debian:/var/www/vnstat# vnstat –help
vnStat 1.10 by Teemu Toivola <tst at iki dot fi>

-q,  –query          query database
-h,  –hours          show hours
-d,  –days           show days
-m,  –months         show months
-w,  –weeks          show weeks
-t,  –top10          show top10
-s,  –short          use short output
-u,  –update         update database
-i,  –iface          select interface (default: eth0)
-?,  –help           short help
-v,  –version        show version
-tr, –traffic        calculate traffic
-ru, –rateunit       swap configured rate unit
-l,  –live           show transfer rate in real time

See also “–longhelp” for complete options list and “man vnstat”

When we type in the vnstat command with the –help parameter we immediately see  some possibilities that vnstat offers. We can preform a query against the database (which we don’t have for the moment) .

Start vnStat

To start vnStat we first need to make a new database. In this example I’ve used the eth0. The following command will create a new database and start monitoring your network traffic. You can monitor multiple interfaces at the same time.

vnstat -i eth0 -u

To get the live traffic you use the following command. vnstat -i eth0 -l (assuming you want the network traffic of eth0).


Yes there is a GUI don’t be afraid, that’s why we needed the apache 2.2 and the PHP5. The official site shows

  • vpsinfo (I haven’t used this one)
  • jsvnstat (just started testing this one, and I noticed that I can only add 1 Ethernet card in one settings file)
  • vnStat PHP frontend (you can add multiple Ethernet cards in 1 settings file)
  • vnStat SVG frontend (I haven’t used this one)

In this tutorial I’m going to install the jsvnstat.

root@debian:/var/www# wget
root@debian:/var/www# unzip

Now you can surf to your server and you will see some nice graphs.


vnStat is a basic tool that provides you real time statistics about your network traffic. Its light-weighted and it does what must do, don’t expect more from it.

The official site

Man page in PDF

Comments are closed.