Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(Update current version's workflow: "Create Interface Database")
(Change to a more descriptive header + Some text changes)
Line 19: Line 19:
 
  # vnstat -u -i wlan0
 
  # vnstat -u -i wlan0
  
=== Updating method ===
+
=== Database Update Method Selection ===
  
After introducing the interface(s) set one of the update methods.
+
After introducing the interface(s) set one of the update methods. {{note|Choose only '''one''' of the following methods ''Systemd Service'' or ''Cron''}}
{{Warning| Only use one of the methods, do not use them at the same time!}}
 
  
==== Cron ====
+
==== Systemd Service (preferred) ====
  
The first method is using [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/usr/share/doc/vnstat/examples/vnstat.cron}}.
+
The recommended way is using [[systemd]] service as provided by the installation:
 +
# systemctl start vnstat.service
  
==== Service ====
+
==== Cron ====
  
The second way is using [[systemd]] (and the provided service):
+
Alternatively you can use [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/usr/share/doc/vnstat/examples/vnstat.cron}}.
# systemctl start vnstat.service
 
  
 
=== Auto-load during boot ===
 
=== Auto-load during boot ===

Revision as of 11:14, 20 January 2015

vnStat is a lightweight network traffic monitor. It keeps a network traffic log on selectable interfaces. Through the command line the network traffic statistics can be shown.

Installation

Install vnstat from the official repositories.

Configuration

Create Interface Database

First you need to create the nvstat director:

# mkdir /var/lib/vnstat

then create the interface database you like to monitor by using the corresponding command. Eg. for eth0:

# vnstat -u -i eth0

or the wireless interface:

# vnstat -u -i wlan0

Database Update Method Selection

After introducing the interface(s) set one of the update methods.

Note: Choose only one of the following methods Systemd Service or Cron

Systemd Service (preferred)

The recommended way is using systemd service as provided by the installation:

# systemctl start vnstat.service

Cron

Alternatively you can use Cron. A sample of Cron usage is provided with vnStat at /usr/share/doc/vnstat/examples/vnstat.cron.

Auto-load during boot

# systemctl enable vnstat.service

Global settings

Other settings, like settings to control the daemon, can be done in /etc/vnstat.conf.

Usage

Query the network traffic:

# vnstat -q

Viewing live network traffic usage:

# vnstat -l

For all the other options, use:

# vnstat --help

Or for a complete list, use:

# vnstat --longhelp

See Also

VnStat Custom WebUI