Pete Freitag Pete Freitag

Great Tool For Network Bandwidth Monitoring: vnstat

Published on January 19, 2009
By Pete Freitag
linuxapple

Did you ever wonder how much bandwidth your linux server is using each month, or each day? There are a number of tools that can give you this information, but many of them are packet sniffers, and can effect performance.

I recently came across a really nice lightweight tool that monitors your network bandwidth utilization on Linux (actually I just learned that it also works on BSD operating systems as well, eg. Mac OSX , so I am running it on my desktop now as well) called vnstat. It works by analyzing the /proc stats on Linux (at regular intervals using a cron job), and then stores summaries in a really small database.

You can then access these stats whenever using the vnstat command line utility.

For example if you run vnstat -m it will generate a nice plain text summary report:

   month         rx      |      tx      |   total
-------------------------+--------------+--------------------------------------
  Dec '08       1.10 GB  |    28.88 MB  |     1.13 GB   %%%%%%%%%%%%%%%%%
  Jan '09       1.35 GB  |    68.79 MB  |     1.41 GB   %%%%%%%%%%%%%%%%%%%%%:
-------------------------+--------------+--------------------------------------
 estimated      2.21 GB  |      111 MB  |     2.31 GB

That particular server is only being used for backups right now, so the numbers are kind of low.

Highly recommend this tool if you are looking for a simple and lightweight way to monitor network bandwidth.

Here's a full list of command line options:

-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
-l,  --live           show transfer rate in real time


vnstat network bandwidth linux mac

Great Tool For Network Bandwidth Monitoring: vnstat was first published on January 19, 2009.

If you like reading about vnstat, network, bandwidth, linux, or mac then you might also like:

Weekly Security Advisories Email

Advisory Week is a new weekly email containing security advisories published by major software vendors (Adobe, Apple, Microsoft, etc).

Comments

Yeah, VNStat is really good at monitoring both in and out traffic on any linux machine.
Something to note, is that there's also a php frontend for it, which is really good too.
(Although, I'll admit I've changed it to show the percentage of my bandwidth used.. but, hey, a books not yours until you scribble notes in the back of it, is it?)

Also, this comment box is really really small on 1024x768.
by Micheil on 02/05/2009 at 7:20:43 AM UTC