Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(Change to a more descriptive header + Some text changes)
(Improve readability a bit by altering the structure to normal usage process.)
Line 2: Line 2:
 
[[ru:vnStat]]
 
[[ru:vnStat]]
 
{{lowercase title}}
 
{{lowercase title}}
[http://humdi.net/vnstat/ 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.
+
[http://humdi.net/vnstat/ 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 ==
 
== Installation ==
Line 9: Line 9:
  
 
== Configuration ==
 
== Configuration ==
 +
 +
First open {{/etc/vnstat.conf}} with your editor and check the interface name is set right, eg.:
 +
# Interface "enp3s0"
 +
  
 
=== Create Interface Database ===
 
=== Create Interface Database ===
  
First you need to create the nvstat director:
+
First you need to create the vnStat directory:
 
  # mkdir /var/lib/vnstat
 
  # mkdir /var/lib/vnstat
then create the interface database you like to monitor by using the corresponding command. Eg. for ''eth0'':
+
then create the interface database you like to monitor by using the corresponding command, eg. ''enp3s0'':
  # vnstat -u -i eth0
+
  # vnstat -u -i enp3s0
 
or the wireless interface:
 
or the wireless interface:
 
  # vnstat -u -i wlan0
 
  # vnstat -u -i wlan0
Line 27: Line 31:
 
The recommended way is using [[systemd]] service as provided by the installation:
 
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:
 +
# systemctl enable vnstat.service
  
 
==== Cron ====
 
==== Cron ====
  
 
Alternatively you can use [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/usr/share/doc/vnstat/examples/vnstat.cron}}.
 
Alternatively you can use [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/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 {{ic|/etc/vnstat.conf}}.
 
  
 
== Usage ==
 
== Usage ==
Line 47: Line 46:
 
  # vnstat -l
 
  # vnstat -l
  
For all the other options, use:
+
To find more options, use:
 
  # vnstat --help
 
  # vnstat --help
Or for a complete list, use:
 
# vnstat --longhelp
 
  
 
== See Also ==
 
== See Also ==
 
[http://gotux.net/arch-linux/vnstat-network-monitor/ VnStat Custom WebUI]
 
[http://gotux.net/arch-linux/vnstat-network-monitor/ VnStat Custom WebUI]

Revision as of 11:26, 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

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

To make this service permanent use:

# systemctl enable 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.

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