Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(improve install link as recommended in Help:Style#Package management instructions)
(→‎Configuration: A database must be initialized to monitor a particular network (why was this not stated already?!))
Line 11: Line 11:
 
== Configuration ==
 
== Configuration ==
  
First open {{ic|/etc/vnstat.conf}} with your editor and check the interface name is set right, eg.:
+
Pick a preferred network interface and edit the {{ic|Interface}} variable in the {{ic|/etc/vnstat.conf}} accordingly. To the list all interfaces available to vnstat, use {{ic|vnstat --iflist}}.
  # Interface "enp3s0"
+
 
 +
To start monitoring a particular interface you must initialize a database first. Each interface needs its own database. The command to initialize one for the {{ic|eth0}} interface is:
 +
  # vnstat -u -i eth0
  
 
=== Start Systemd Service ===
 
=== Start Systemd Service ===

Revision as of 12:52, 29 April 2016

vnStat is a lightweight (command line) network traffic monitor. It monitors selectable interfaces and stores network traffic logs in a database for later analysis.

Installation

Install vnstat from the official repositories.

Configuration

Pick a preferred network interface and edit the Interface variable in the /etc/vnstat.conf accordingly. To the list all interfaces available to vnstat, use vnstat --iflist.

To start monitoring a particular interface you must initialize a database first. Each interface needs its own database. The command to initialize one for the eth0 interface is:

# vnstat -u -i eth0 

Start Systemd Service

After introducing the interface(s) and checking the config file. You can start the monitoring process via systemd

# systemctl start vnstat.service

To make this service permanent use

# systemctl enable vnstat.service

Usage

Query the network traffic:

# vnstat -q

Viewing live network traffic usage:

# vnstat -l

To find more options, use:

# vnstat --help