Difference between revisions of "VnStat"

From ArchWiki
Jump to navigation Jump to search
(Change section to systemd only, because cron example isn't provided anymore.)
m (→‎Usage: Changing command options to long options)
 
(16 intermediate revisions by 11 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 (command line) network traffic monitor. It monitors selectable interfaces and stores network traffic logs in a database for later analysis.
 
[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 ==
  
First open {{/etc/vnstat.conf}} with your editor and check the interface name is set right, eg.:
+
[[systemd#Using units|Start/Enable]] the {{ic|vnstat.service}} daemon.
# Interface "enp3s0"
 
  
 +
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}}.
  
=== Create Interface Database ===
+
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
  
First you need to create the vnStat directory:
+
Remember to [[restart]] the {{ic|vnstat.service}} daemon after you have added a new interface.
# 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 ==
 
== 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
  
 
To find more options, use:
 
To find more options, use:
 
  # vnstat --help
 
  # vnstat --help
 
+
or to see all options use:
== See Also ==
+
# vnstat --longhelp
[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