Monitoring Network Traffic using Vnstat and Vnstati

Sponsored Link
vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources.

The purpose of vnstati is to provide image output support for statistics collected using vnstat. The image file format is limited to png. All basic outputs of vnStat are supported excluding live traffic features. The image can be outputted either to a file or to standard output.

Install Vnstat and Vnstati on Ubuntu

Open the terminal and run the following command

sudo apt-get install vnstat vnstati

Vnstat Examples

vnstat -- Display traffic summary for the default interface or multiple interfaces when more than one is monitored.

vnstat -i eth0+eth1+eth3

Display traffic summary for a merge of interfaces eth0, eth1 and eth3.

vnstat -i eth2 --xml

Output all information about interface eth2 in xml format.

vnstat --json

Output all information of all monitored interfaces in json format.

vnstat -u -i eth0

Force a database update for interface eth0 or create the database if it doesn't exist. This is usually the first command used after a fresh install if the daemon isn't used.

vnstat -u -i eth0 --nick local

Give interface eth0 the nickname "local". That information will be later later visible as a label when eth0 is queried. The database will also be updated when this command is executed or created if the database doesn't exist.

vnstat -i eth2 --delete

Delete database of interface eth2 and stop monitoring it.

Vnstati Examples

vnstati -s -i eth0 -o /tmp/vnstat.png

Output traffic summary for interface eth0 to file /tmp/vnstat.png.

vnstati -vs -i eth0+eth1+eth2 -o /tmp/vnstat.png

Output traffic summary with hourly data under the normal summary for a merge of interfaces eth0, eth1 and eth2 to file /tmp/vnstat.png.

vnstati -h -c 15 -o /tmp/vnstat_h.png

Output hourly traffic statistics for default interface to file /tmp/vnstat_h.png if the file has not been updated within the last 15 minutes.

vnstati -d -ne -nh -o --

Output daily traffic statistics without displaying the header section and edges for default interface to standard output (stdout).

vnstati -m --config /home/me/vnstat.cfg -i -o --

output monthly traffic statistics for default interface specified in configuration file /home/me/vnstat.cfg to standard output (stdout).

Screenshot

vnstat

Sponsored Link

Related posts

Leave a comment

Your email address will not be published. Required fields are marked *