1VNSTATD(1)                       User Manuals                       VNSTATD(1)
2
3
4

NAME

6       vnstatd - daemon based database updating for vnStat
7
8

SYNOPSIS

10       vnstatd  [ -Ddnpsv?  ] [ --alwaysadd ] [ --config file ] [ --daemon ] [
11       --debug ] [ -g group ] [ --group group ] [  --help  ]  [  --noadd  ]  [
12       --nodaemon ] [ --pidfile file ] [ --sync ] [ --u user ] [ --user user ]
13       [ --version ]
14
15

DESCRIPTION

17       The purpose of vnstatd is to provide a more flexible and robust way for
18       updating vnstat(1) databases than what using cron for updating can pro‐
19       vide. The daemon makes possible updating databases more  often  but  at
20       the  same  time  causes  less  disk access since data can be cached and
21       written only later to disk at a user configurable interval. The  avail‐
22       ability  of  each  interface is automatically tracked which removes the
23       need for additional scripts to be implemented and called when an inter‐
24       face comes online or goes offline.
25
26       vnstatd  is  the command for starting the daemon. The daemon can either
27       fork itself to run as a background process or stay attached to the ter‐
28       minal.  It supports logging to a user selectable file or using syslog.
29
30       Once started, the daemon will read vnstat.conf(5) if available and then
31       check if there are any databases present in the database directory that
32       has  been  specified in the configuration file. By default, if no data‐
33       bases are found, new databases will be created during startup  for  all
34       available interfaces excluding pseudo interfaces lo, lo0 and sit0. This
35       automatic database addition behaviour can be disabled using the --noadd
36       option. Alternatively, it is possible to allow the daemon to create new
37       databases whenever previously unseen interfaces  become  visible  using
38       the --alwaysadd option.
39
40       The  daemon  will proceed to track the availability of monitored inter‐
41       faces, process the interface traffic statistics and write new values to
42       databases  at  a  configured  interval. As a result, the daemon ends up
43       spending most of the time sleeping between updates.
44
45

OPTIONS

47       --alwaysadd
48              Enable automatic creation of new databases for previously unseen
49              interfaces even if the database directory already contains data‐
50              bases when the daemon is started. New databases  will  also  get
51              created  for  new  interfaces  seen while the daemon is running.
52              Pseudo interfaces lo, lo0 and sit0  are  excluded  from  getting
53              added.
54
55
56       --config file
57              Use  file as configuration file instead of using normal configu‐
58              ration file search functionality.
59
60
61       -d, --daemon
62              Fork process to background and run as a daemon.
63
64
65       -D, --debug
66              Provide additional output for debug purposes. The  process  will
67              stay attached to the terminal for output.
68
69
70       -g, --group group
71              Set  daemon process group to group during startup.  group can be
72              either the name of the group  or  a  numerical  group  id.  This
73              option can only be used when the process is started as root.
74
75
76       --noadd
77              Disable  automatic  creation  of new databases for all available
78              interfaces if the daemon is started with  zero  database  found.
79              Pseudo  interfaces  lo,  lo0  and sit0 are excluded from getting
80              added.
81
82
83       -n, --nodaemon
84              Stay in foreground attached to the current  terminal  and  start
85              the update process.
86
87
88       -p, --pidfile file
89              Write  the  process  id  to  file and use it for locking so that
90              another instance of the daemon cannot be  started  if  the  same
91              file is specified.
92
93
94       -s, --sync
95              Synchronize  internal  counters  in  the database with interface
96              counters for all available interfaces  before  starting  traffic
97              monitoring.  Use this option if the traffic between the previous
98              shutdown and the current startup  of  the  daemon  needs  to  be
99              ignored.  This  option  isn't required in normal use because the
100              daemon will  automatically  synchronize  the  internal  counters
101              after  a system reboot, if enough time has passed since the dae‐
102              mon was previously running  or  if  the  internal  counters  are
103              clearly out of sync.
104
105
106       -u, --user user
107              Set  daemon  process  user  to user during startup.  user can be
108              either the login of the user or a numerical user id. This option
109              can only be used when the process is started as root.
110
111
112       -v, --version
113              Show current version of the daemon executable.
114
115
116       -?, --help
117              Show a command option summary.
118
119

CONFIGURATION

121       The  behaviour  of the daemon is configured mainly using the configura‐
122       tion keywords UpdateInterval, PollInterval and SaveInterval in the con‐
123       figuration file.
124
125
126       UpdateInterval  defines  in  seconds  how  often  the interface data is
127       fetched and updated.  This is similar to the run interval for  alterna‐
128       tive  cron  based  updating.   However, the difference is that the data
129       doesn't directly get written to disk during updates.
130
131
132       PollInterval defines in seconds how often the list of available  inter‐
133       faces  is  checked for possible changes. The minimum value is 2 seconds
134       and the maximum 60 seconds.  PollInterval also defines  the  resolution
135       for other intervals.
136
137
138       SaveInterval  defines  in  minutes  how  often cached interface data is
139       written to disk.  A write can only occur during the updating of  inter‐
140       face  data. Therefore, the value should be a multiple of UpdateInterval
141       with a maximum value of 60 minutes.
142
143
144       The default values of UpdateInterval 30, SaveInterval 5 and  PollInter‐
145       val  5  are usually suitable for most systems and provide a similar be‐
146       haviour as cron based updating does but with a  better  resolution  for
147       interface changes and fast interfaces.
148
149
150       For  embedded  and/or  low  power systems more tuned configurations are
151       possible.  In such cases  if  the  interfaces  are  mostly  static  the
152       PollInterval  can be increased to around 10-30 seconds and UpdateInter‐
153       val set to 60 seconds. Higher values up to 300 seconds are possible  if
154       the  interface speed is 10 Mbit or less.  SaveInterval can be increased
155       for example to 15, 30 or even 60 minutes depending  on  how  often  the
156       data needs to be viewed.
157
158

SIGNALS

160       The daemon is listening to signals SIGHUP, SIGINT and SIGTERM.  Sending
161       the SIGHUP signal to the daemon will cause cached data to be written to
162       disk,  a rescan of the database directory and a reload of settings from
163       the configuration file. However, the pid  file  location  will  not  be
164       changed even if it's configuration setting has been modified.
165
166
167       SIGTERM  and  SIGINT  signals will cause the daemon to write all cached
168       data to disk and then exit.
169
170

FILES

172       /var/lib/vnstat/
173              Default database directory. Files are  named  according  to  the
174              monitored interfaces.
175
176       /etc/vnstat.conf
177              Config file that will be used unless $HOME/.vnstatrc exists. See
178              the configuration chapter and vnstat.conf(5) for  more  informa‐
179              tion.
180
181       /var/log/vnstat.log
182              Log  file  that will be used if logging to file is enable and no
183              other file is specified in the config file.
184
185       /var/run/vnstat.pid
186              File used for storing the process id if no other file is  speci‐
187              fied in the configuration file or using the command line parame‐
188              ter.
189
190

RESTRICTIONS

192       Updates needs to be executed at least as often as it  is  possible  for
193       the  interface to generate enough traffic to overflow the kernel inter‐
194       face traffic counter. Otherwise, it is possible that some traffic won't
195       be seen. This isn't an issue for 64-bit kernels but at least one update
196       every hour is always required in order to provide proper  input.   With
197       32-bit  kernels,  the  maximum  time between two updates depends on how
198       fast the interface can transfer 4  GiB.  Calculated  theoretical  times
199       are:
200
201
202              10 Mbit:        54 minutes
203              100 Mbit:        5 minutes
204              1000 Mbit:      30 seconds
205
206       However, for 1000 Mbit interfaces updating once every minute is usually
207       a usable solution if faster updates can't be used.
208
209       Virtual and aliased interfaces cannot be monitored because  the  kernel
210       doesn't  provide  traffic information for that type of interfaces. Such
211       interfaces are usually named eth0:0, eth0:1, eth0:2 etc. where eth0  is
212       the actual interface being aliased.
213
214

AUTHOR

216       Teemu Toivola <tst at iki dot fi>
217
218

SEE ALSO

220       vnstat(1), vnstati(1), vnstat.conf(5), signal(7)
221
222
223
224version 1.18                      MARCH 2018                        VNSTATD(1)
Impressum