Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
m (→‎Configuration: order of operations corrected, the service should be started first to create the directory structure)
Line 10: Line 10:
  
 
== Configuration ==
 
== Configuration ==
 +
 +
[[systemd#Using units|Start/Enable]] the {{ic|vnstat.service}} daemon.
  
 
Pick a preferred network interface and edit the {{ic|Interface}} variable in the {{ic|/etc/vnstat.conf}} accordingly. To list all interfaces available to vnstat, use {{ic|vnstat --iflist}}.
 
Pick a preferred network interface and edit the {{ic|Interface}} variable in the {{ic|/etc/vnstat.conf}} accordingly. To list all interfaces available to vnstat, use {{ic|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 {{ic|eth0}} interface is:
 
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  
+
  # 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 ==
 
== Usage ==

Revision as of 07:52, 30 September 2017

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 the vnstat package.

Configuration

Start/Enable the vnstat.service daemon.

Pick a preferred network interface and edit the Interface variable in the /etc/vnstat.conf accordingly. To 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

Usage

Query the network traffic:

# vnstat -q

Viewing live network traffic usage:

# vnstat -l

To find more options, use:

# vnstat --help