1VNSTATD(1) User Manuals VNSTATD(1)
2
3
4
6 vnStat daemon - the alternative for cron based updating
7
8
10 vnstatd [ -Ddnpsv? ] [ --config file ] [ --daemon ] [ --debug ] [
11 --help ] [ --noadd ] [ --nodaemon ] [ --pidfile file ] [ --sync ] [
12 --version ]
13
14
16 The purpose of vnstatd is to provide a more flexible way for updating
17 vnstat(1) databases than what using cron for updating can provide. The
18 daemon makes possible updating databases more often but at the same
19 time requires less disk access since data can be cached and written
20 only later to disk at a user configurable interval. It is also able to
21 track how interfaces come and go without the need of additional scripts
22 that are required with cron based updates.
23
24 vnstatd is the command for starting the daemon. The daemon can either
25 fork itself to run as a background process or stay attached to the ter‐
26 minal. It supports logging to a user selectable file or using syslog.
27
28 Once started, the daemon will check if there are any databases avail‐
29 able in the database directory that has been specified in the configu‐
30 ration file. New databases will be created for all available interfaces
31 excluding pseudo interfaces lo, lo0 and sit0 if no databases are found
32 during startup.
33
34
36 --config file
37 Use file as config file instead of using normal config file
38 search function.
39
40
41 -d, --daemon
42 Fork process to background and run as a daemon.
43
44
45 -D, --debug
46 Provide additional output for debug purposes. The process will
47 stay attached to the terminal for output.
48
49
50 --noadd
51 Disable automatic creation of new databases for all available
52 interfaces if the daemon is started with zero database found.
53 Pseudo interfaces lo, lo0 and sit0 are excluded from getting
54 added.
55
56
57 -n, --nodaemon
58 Stay in foreground attached to the current terminal and start
59 update process.
60
61
62 -p, --pidfile file
63 Write the process id to file and use it for locking so that
64 another instance of the daemon cannot be started if the same
65 file is specified.
66
67
68 -s, --sync
69 Synchronize internal counters in the database with interface
70 counters for all available interfaces before starting traffic
71 monitoring. Use this option if the traffic between the previous
72 shutdown and the current startup of the daemon needs to be
73 ignored. This option isn't required in normal use because the
74 daemon will automatically synchronize the internal counters
75 after a system reboot, if enought time has passed since the dae‐
76 mon was previously running or if the internal counters are
77 clearly out of sync.
78
79
80 -v, --version
81 Show current version.
82
83
84 -?, --help
85 Show a command summary.
86
87
89 The behaviour of the daemon is configured mainly using the configura‐
90 tion keywords UpdateInterval, PollInterval and SaveInterval in the con‐
91 figuration file.
92
93
94 UpdateInterval defines in seconds how often the interface data is
95 updated. This is similar to the run interval for alternative cron
96 based updating. However, the difference is that the data doesn't get
97 written to disk during updates.
98
99
100 PollInterval defines in seconds how often the list of available inter‐
101 faces is checked for possible changes. The minimum value is 2 seconds
102 and the maximum 60 seconds. PollInterval also defines the resolution
103 for other intervals.
104
105
106 SaveInterval defines in minutes how often cached interface data is
107 written to disk. A write can only occur during the updating of inter‐
108 face data. Therefore, the value should be a multiple of UpdateInterval
109 with a maximum value of 60 minutes.
110
111
112 The default values of UpdateInterval 20, SaveInterval 5 and PollInter‐
113 val 2 are usually suitable for most systems and provide a similar be‐
114 haviour as cron based updating does but with a better resolution for
115 interface changes and fast interfaces.
116
117
118 For embedded and/or low power systems more tuned configurations are
119 possible. In such cases if the interfaces are mostly static the
120 PollInterval can be rised to around 10-30 seconds and UpdateInterval
121 set to 60 seconds. Higher values up to 300 seconds are possible if the
122 interface speed is 10 Mbit or less. SaveInterval can be rised for
123 example to 15, 30 or even 60 minutes depending on how often the data
124 needs to be viewed.
125
126
128 The daemon is listening to signals SIGHUP, SIGINT and SIGTERM. Sending
129 the SIGHUP signal to the daemon will cause cached data to be written to
130 disk, a rescan of the database directory and a reload of settings from
131 the configuration file. However, the pid file will not be updated even
132 if it's configuration setting has been changed.
133
134
135 SIGTERM and SIGINT signals will cause the daemon to write all cached
136 data to disk and then exit.
137
138
140 /var/lib/vnstat/
141 Default database directory. Files are named according to the
142 monitored interfaces.
143
144 /etc/vnstat.conf
145 Config file that will be used unless $HOME/.vnstatrc exists. See
146 the configuration chapter and vnstat.conf(5) for more informa‐
147 tion.
148
149 /var/log/vnstat.log
150 Log file that will be used if logging to file is enable and no
151 other file is specified in the config file.
152
153 /var/run/vnstat.pid
154 File used for storing the process id if no other file is speci‐
155 fied in the configuration file or using the command line parame‐
156 ter.
157
158
160 Updates needs to be executed at least as often as it is possible for
161 the interface to generate enough traffic to wrap the kernel interface
162 traffic counter. Otherwise it is possible that some traffic won't be
163 seen. This isn't an issue for 64 bit kernels but at least one update
164 every hour is always required in order to provide proper input. With
165 32 bit kernels the maximum time between two updates depends on how fast
166 the interface can transfer 4 GiB. Calculated theoretical times are:
167
168 10 Mbit: 54 minutes
169 100 Mbit: 5 minutes
170 1000 Mbit: 30 seconds
171
172 However, for 1000 Mbit interfaces updating once every minute is usually
173 a working solution.
174
175 Virtual and aliased interfaces cannot be monitored because the kernel
176 doesn't provide traffic information for that type of interfaces. Such
177 interfaces are usually named eth0:0, eth0:1, eth0:2 etc. where eth0 is
178 the actual interface being aliased.
179
180
182 Teemu Toivola <tst at iki dot fi>
183
184
186 vnstat(1), vnstati(1), vnstat.conf(5), signal(7)
187
188
189
190version 1.11 JUNE 2011 VNSTATD(1)