Content-type: text/html
Man page of VNSTAT
VNSTAT
Section: User Manuals (1)
Updated: JANUARY 2008
Index
Return to Main Contents
NAME
vnStat - a console-based network traffic monitor
SYNOPSIS
vnstat
[
-Ddhlmqrstuvw?
] [
-i
interface
] [
-tr
time
] [
--cleartop
] [
--config
file
] [
--days
] [
--debug
] [
--disable
] [
--dumpdb
] [
--enable
] [
--help
] [
--hours
] [
--iface
interface
] [
--live
] [
--longhelp
] [
--months
] [
--nick
nickname
] [
--query
] [
--rebuildtotal
] [
--reset
] [
--short
] [
--showconfig
] [
--testkernel
] [
--top10
] [
--traffic
time
] [
--update
] [
--version
] [
--weeks
]
DESCRIPTION
vnStat
is a console-based network traffic monitor. It keeps a log of hourly,
daily and monthly network traffic for the selected interface(s). However,
it isn't a packet sniffer. The traffic information is analyzed from the
proc(5)
filesystem. That way vnStat can be used even without root permissions.
OPTIONS
- -d, --days
-
Show traffic for days.
- -h, --hours
-
Show traffic for the last 24 hours.
- -m, --months
-
Show traffic for months.
- -s, --short
-
Use short output mode. This mode is also used if more than one
database is available.
- -t, --top10
-
Show all time top10 traffic days.
- -w, --weeks
-
Show traffic for 7 days, current and previous week.
- -tr time
-
Calculate how much traffic goes through the selected interface during
the given
time
seconds. The
time
will be 5 seconds if a number parameter isn't included.
- -l, --live
-
Display current transfer rate for the selected interface in real time
until interrupted. Statistics will be shown after interruption if runtime
was more than 10 seconds.
- -i, --iface interface
-
Select one specific
interface
and apply actions to only it.
- -q, --query
-
Force database query mode.
- -u, --update
-
Update all enabled databases or only the one specified with
-i
parameter.
- -r, --reset
-
Reset the internal counters in the database for the selected
interface. Use this if the interface goes down and back up,
otherwise that interface will get some extra traffic to its database.
- --sync
-
Synchronize internal counters in the database with interface
counters for the selected interface. Use this if the system is
rebooted but interface counters aren't reseted. Such can occur
when suspend to ram/disk is used.
- --enable, --disable
-
Enable or disable updates for selected interface. Useful for
interfaces that aren't always available, like ppp0. If the interface
goes down it should be disabled in order to avoid errors. Add something
like
vnstat -r --disable -i ppp0
to the script that's executed when
the interface goes down and
vnstat --enable -i ppp0
to the up script.
- -v, --version
-
Show current version.
- --cleartop
-
Remove all top10 entries.
- -?, --help
-
Show a command summary.
- --longhelp
-
Show complete options list.
- --nick nickname
-
Set the selected interfaces
nickname
as an alias the will be displayed in queries. Usage of
-u
is required to save the change.
- --config file
-
Use
file
as config file instead of using normal config file search function.
- --rebuildtotal
-
Reset the total traffic counters and recount those using recorded months.
- --testkernel
-
Test if the kernel boot time information always stays the same like it should or
if it's shifting.
- -D, --debug
-
Show additional debug output.
- --dumpdb
-
Instead of showing the database with a formated output, this output will
dump the whole database in a format that should be easy to parse with most
script languages. Use this for example with PHP, Perl or Python to make a
custom webpage. The dump uses ; as field delimeter.
active;1 activity status
interface;eth0 name for the interface
nick;inet nick (if given)
created;1023895272 creation date in Unix time
updated;1065467100 when the database was updated
totalrx;569605 all time total received MB
totaltx;2023708 all time total transmitted MB
currx;621673719 latest rx value in /proc
curtx;981730184 latest tx value in /proc
totalrxk;644 total rx kB counter
totaltxk;494 total tx kB counter
btime;1059414541 system boot time in Unix time
Then follows 30 lines like the following
d;0;1078696800;559;7433;68;557;1
where d = days, 0 = day number in database (0 is today), 1077314401 date in
Unix time, 559 = rx MB, 7433 = tx MB, 68 = rx kB, 557 = tx kB and 1 tells that
vnStat has filled this value and it is in use.
m;0;1078092000;48649;139704;527;252;1 (x12)
t;0;1078351200;5979;47155;362;525;1 (x10)
h;0;1078699800;118265;516545 (x24)
m = months, t = top10 and h = hours, all other fields are in the same order as in days
except hours that doesn't have a separate kB value. For hours the forth and fifth fields
have values in kB.
FILES
- /var/lib/vnstat/
-
This directory contains all databases the program uses. Files are
named according to the monitored interfaces.
- /etc/vnstat.conf
-
Config file that will be used unless
$HOME/.vnstatrc
exists.
EXAMPLES
vnstat -u -i
interface
forces a database update for
interface
or creates the database if it doesn't exist. This is usually the
first command used after a fresh install.
vnstat -u -i
interface
--nick
nick
gives
interface
the nickname
nick
and that information will be later included with queries.
vnstat -u -r --disable -i
interface
resets the internal counters of
interface
and disables it from being updated before enabled again with the
--enable
parameter. This feature is especially useful for interfaces like ppp0
that aren't always active.
RESTRICTIONS
Updates needs to be executed at least as often as it is possible for the interface
to generate enough traffic to wrap the kernel interface traffic counter. Otherwise
it is possible that some traffic won't be seen. This isn't an issue for 64 bit kernels
but at least one update every hour is always required in order to provide proper input.
With 32 bit kernels the maximum time between two updates depends on how fast the
interface can transfer 4 GB. Calculated theoretical times are:
10 Mbit: 54 minutes
100 Mbit: 5 minutes
1000 Mbit: 30 seconds
However, for 1000 Mbit interfaces updating once every minute is usually a
working solution.
Estimated traffic values are likely to be somewhat inaccurate if daily
traffic is low because only the MB counter is used to calculate the
estimate.
Virtual and aliased interfaces can't be monitored because the kernel doesn't
provide traffic information for that type of interfaces. Such interfaces are
usually named eth0:0, eth0:1, eth0:2 etc. where eth0 is the actual interface
being aliased.
AUTHOR
Teemu Toivola <tst at iki dot fi>
SEE ALSO
proc(5),
ifconfig(8)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- FILES
-
- EXAMPLES
-
- RESTRICTIONS
-
- AUTHOR
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 03:41:18 GMT, September 24, 2010