Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(Improve readability a bit by altering the structure to normal usage process.)
(Change section to systemd only, because cron example isn't provided anymore.)
Line 23: Line 23:
 
  # vnstat -u -i wlan0
 
  # vnstat -u -i wlan0
  
=== Database Update Method Selection ===
+
=== Start Systemd Service ===
  
After introducing the interface(s) set one of the update methods. {{note|Choose only '''one''' of the following methods ''Systemd Service'' or ''Cron''}}
+
After introducing the interface(s) and checking the config file. You can start the monitoring process via [[systemd]]
 
 
==== Systemd Service (preferred) ====
 
 
 
The recommended way is using [[systemd]] service as provided by the installation:
 
 
  # systemctl start vnstat.service
 
  # systemctl start vnstat.service
To make this service permanent use:
+
To make this service permanent use
 
  # systemctl enable vnstat.service
 
  # systemctl enable vnstat.service
 
==== Cron ====
 
 
Alternatively you can use [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/usr/share/doc/vnstat/examples/vnstat.cron}}.
 
  
 
== Usage ==
 
== Usage ==

Revision as of 11:33, 20 January 2015

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

First open VnStat/etc/vnstat.conf with your editor and check the interface name is set right, eg.:

# Interface "enp3s0"


Create Interface Database

First you need to create the vnStat directory:

# mkdir /var/lib/vnstat

then create the interface database you like to monitor by using the corresponding command, eg. enp3s0:

# vnstat -u -i enp3s0

or the wireless interface:

# vnstat -u -i wlan0

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

See Also

VnStat Custom WebUI