1VNSTAT(1) User Manuals VNSTAT(1)
2
3
4
6 vnStat - a console-based network traffic monitor
7
9 vnstat [ -Ddhmqrstuvw? ] [ -i interface ] [ -tr time ] [ --cleartop ]
10 [ --days ] [ --debug ] [ --disable ] [ --dumpdb ] [ --enable ] [ --help
11 ] [ --hours ] [ --iface interface ] [ --longhelp ] [ --months ] [
12 --nick nickname ] [ --query ] [ --rebuildtotal ] [ --reset ] [ --short
13 ] [ --testkernel ] [ --top10 ] [ --traffic time ] [ --update ] [ --ver‐
14 sion ] [ --weeks ]
15
17 vnStat is a console-base network traffic monitor that keeps a log of
18 daily and monthly network traffic for the selected interface(s). How‐
19 ever, it isn't a packet sniffer. The traffic information is analyzed
20 from the proc(5) -filesystem, so that vnStat can be used without root
21 permissions.
22
24 -D, --debug
25 Show additional debug output.
26
27 -d, --days
28 Show traffic for days.
29
30 -h, --hours
31 Show traffic for the last 24 hours.
32
33 -i, --iface interface
34 Select one specific interface and apply actions to only it.
35
36 -m, --months
37 Show traffic for months.
38
39 -q, --query
40 Force database query mode.
41
42 -r, --reset
43 Reset the internal counters in the database for the selected
44 interface. Use this if the interface goes down and back up, oth‐
45 erwise that interface will get some extra traffic to its data‐
46 base.
47
48 -s, --short
49 Use short output mode. This mode is also used if more than one
50 database is available.
51
52 -t, --top10
53 Show all time top10 traffic days.
54
55 -tr time
56 Calculate how much traffic goes through the selected interface
57 during the given time seconds. The time will be 5 seconds if a
58 number parameter isn't included.
59
60 -u, --update
61 Update all enabled databases or only the one specified with -i
62 parameter.
63
64 -v, --version
65 Show current version.
66
67 -w, --weeks
68 Show traffic for 7 days, current and previous week.
69
70 --cleartop
71 Remove all top10 entries.
72
73 --dumpdb
74 Instead of showing the database with a formated output, this
75 output will dump the whole database in a format that should be
76 easy to parse with most script languages. Use this for example
77 with php or perl to make a custom webpage. The dump uses ; as
78 field delimeter.
79
80 active;1 activity status
81 interface;eth0 name for the interface
82 nick;inet nick (if given)
83 created;1023895272 creation date in Unix time
84 updated;1065467100 when the database was updated
85 totalrx;569605 all time total received MB
86 totaltx;2023708 all time total transmitted MB
87 currx;621673719 latest rx value in /proc
88 curtx;981730184 latest tx value in /proc
89 totalrxk;644 total rx kB counter
90 totaltxk;494 total tx kB counter
91 btime;1059414541 system boot time in Unix time
92
93 Then follows 30 lines like the following
94
95 d;0;1078696800;559;7433;68;557;1
96
97 where d = days, 0 = day number in database (0 is today),
98 1077314401 date in Unix time, 559 = rx MB, 7433 = tx MB, 68 = rx
99 kB, 557 = tx kB and 1 tells that vnStat has filled this value
100 and it is in use.
101
102 m;0;1078092000;48649;139704;527;252;1 (x12)
103 t;0;1078351200;5979;47155;362;525;1 (x10)
104 h;0;1078699800;118265;516545 (x24)
105
106 m = months, t = top10 and h = hours, all other fields are in the
107 same order as in days except hours that doesn't have a separate
108 kB value. For hours the forth and fifth fields have values in
109 kB.
110
111 --enable, --disable
112 Enable or disable updates for selected interface. Useful for
113 interfaces that aren't always available, like ppp0. If the
114 interface goes down it should be disabled in order to avoid
115 errors. Add something like vnstat -r --disable -i ppp0 to the
116 script that's executed when the interface goes down and vnstat
117 --enable -i ppp0 to the up script.
118
119 -?, --help
120 Show a command summary.
121
122 --longhelp
123 Show complete options list.
124
125 --nick nickname
126 Set the selected interfaces nickname as an alias the will be
127 displayed in queries. Usage of -u is required to save the
128 change.
129
130 --rebuildtotal
131 Reset the total traffic counters and recount those using
132 recorded months.
133
134 --testkernel
135 Test if the kernel btime stays always to same like it should or
136 if it's shifting.
137
139 /var/lib/vnstat/
140 This directory contains all databases the program uses. Files
141 are named according to the monitored interfaces.
142
144 vnstat -u -i interface forces a database update for interface or cre‐
145 ates the database if it doesn't exist. This is usually the first com‐
146 mand used after a fresh install.
147
148 vnstat -u -i interface --nick nick gives interface the nickname nick
149 and that information will be later included with queries.
150
151 vnstat -u -r --disable -i interface resets the internal counters of
152 interface and disables it from being updated before enabled again with
153 the --enable parameter. This feature is especially useful for inter‐
154 faces like ppp0 that aren't always active.
155
157 64bit counters can't currently be automatically detected, therefore
158 support must be specified before compiling.
159
160 Estimated traffic values are likely to be somewhat inaccurate if daily
161 traffic is low because only the MB counter is used to calculate the
162 estimate.
163
165 Teemu Toivola <tst at iki dot fi>
166
168 proc(5)
169
170
171
172Linux MARCH 2004 VNSTAT(1)