Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(Change to a more descriptive header + Some text changes)
m (→‎Usage: Changing command options to long options)
 
(18 intermediate revisions by 12 users not shown)
Line 1: Line 1:
 +
{{lowercase title}}
 
[[Category:Networking]]
 
[[Category:Networking]]
[[ru:vnStat]]
+
[[ja:VnStat]]
{{lowercase title}}
+
[[ru:VnStat]]
[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 ==
  
[[pacman|Install]] {{Pkg|vnstat}} from the [[official repositories]].
+
[[Install]] the {{Pkg|vnstat}} package.
  
 
== Configuration ==
 
== Configuration ==
  
=== Create Interface Database ===
+
[[systemd#Using units|Start/Enable]] the {{ic|vnstat.service}} daemon.
 
 
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:
+
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}}.
# systemctl start vnstat.service
 
  
==== Cron ====
+
To start monitoring a particular interface that was not referred to in the configuration file when the daemon was started, you must initialize a database first. Each interface needs its own database. The command to initialize one for the {{ic|eth0}} interface is:
 +
# vnstat --add -i eth0
  
Alternatively you can use [[Cron]]. A sample of Cron usage is provided with vnStat at {{ic|/usr/share/doc/vnstat/examples/vnstat.cron}}.
+
Remember to [[restart]] the {{ic|vnstat.service}} daemon after you have added a new interface.
 
 
=== 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 ==
  
 
Query the network traffic:
 
Query the network traffic:
  # vnstat -q
+
  # vnstat --query
  
 
Viewing live network traffic usage:
 
Viewing live network traffic usage:
  # vnstat -l
+
  # vnstat --live
  
For all the other options, use:
+
To find more options, use:
 
  # vnstat --help
 
  # vnstat --help
Or for a complete list, use:
+
or to see all options use:
 
  # vnstat --longhelp
 
  # vnstat --longhelp
 
== See Also ==
 
[http://gotux.net/arch-linux/vnstat-network-monitor/ VnStat Custom WebUI]
 

Latest revision as of 19:24, 8 March 2019

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 that was not referred to in the configuration file when the daemon was started, you must initialize a database first. Each interface needs its own database. The command to initialize one for the eth0 interface is:

# vnstat --add -i eth0

Remember to restart the vnstat.service daemon after you have added a new interface.

Usage

Query the network traffic:

# vnstat --query

Viewing live network traffic usage:

# vnstat --live

To find more options, use:

# vnstat --help

or to see all options use:

# vnstat --longhelp