Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
VNSTATD(1)			 User Manuals			    VNSTATD(1)

       vnstatd - daemon	based database updating	for vnStat

       vnstatd	[ -Ddnpsv?  ] [	--alwaysadd ] [	--config file ]	[ --daemon ] [
       --debug ] [ -g group ] [	--group	group ]	[  --help  ]  [	 --noadd  ]  [
       --nodaemon ] [ --pidfile	file ] [ --sync	] [ --u	user ] [ --user	user ]
       [ --version ]

       The purpose of vnstatd is to provide a more flexible and	robust way for
       updating	vnstat(1) databases than what using cron for updating can pro-
       vide. The daemon	makes possible updating	databases more	often  but  at
       the  same  time	causes	less  disk access since	data can be cached and
       written only later to disk at a user configurable interval. The	avail-
       ability	of  each  interface is automatically tracked which removes the
       need for	additional scripts to be implemented and called	when an	inter-
       face comes online or goes offline.

       vnstatd	is  the	command	for starting the daemon. The daemon can	either
       fork itself to run as a background process or stay attached to the ter-
       minal.  It supports logging to a	user selectable	file or	using syslog.

       Once started, the daemon	will read vnstat.conf(5) if available and then
       check if	there are any databases	present	in the database	directory that
       has  been  specified in the configuration file. By default, if no data-
       bases are found,	new databases will be created during startup  for  all
       available interfaces excluding pseudo interfaces	lo, lo0	and sit0. This
       automatic database addition behaviour can be disabled using the --noadd
       option. Alternatively, it is possible to	allow the daemon to create new
       databases whenever previously unseen interfaces	become	visible	 using
       the --alwaysadd option.

       The  daemon  will proceed to track the availability of monitored	inter-
       faces, process the interface traffic statistics and write new values to
       databases  at  a	 configured  interval. As a result, the	daemon ends up
       spending	most of	the time sleeping between updates.

	      Enable automatic creation	of new databases for previously	unseen
	      interfaces even if the database directory	already	contains data-
	      bases when the daemon is started.	New databases  will  also  get
	      created  for  new	 interfaces  seen while	the daemon is running.
	      Pseudo interfaces	lo, lo0	and sit0  are  excluded	 from  getting

       --config	file
	      Use  file	as configuration file instead of using normal configu-
	      ration file search functionality.

       -d, --daemon
	      Fork process to background and run as a daemon.

       -D, --debug
	      Provide additional output	for debug purposes. The	 process  will
	      stay attached to the terminal for	output.

       -g, --group group
	      Set  daemon process group	to group during	startup.  group	can be
	      either the name of the group or a	numerical group	id.  This  op-
	      tion can only be used when the process is	started	as root.

	      Disable  automatic  creation  of new databases for all available
	      interfaces if the	daemon is started with	zero  database	found.
	      Pseudo  interfaces  lo,  lo0  and	sit0 are excluded from getting

       -n, --nodaemon
	      Stay in foreground attached to the current  terminal  and	 start
	      the update process.

       -p, --pidfile file
	      Write  the process id to file and	use it for locking so that an-
	      other instance of	the daemon cannot be started if	the same  file
	      is specified.

       -s, --sync
	      Synchronize  internal  counters  in  the database	with interface
	      counters for all available interfaces  before  starting  traffic
	      monitoring.  Use this option if the traffic between the previous
	      shutdown and the current startup of the daemon needs to  be  ig-
	      nored. This option isn't required	in normal use because the dae-
	      mon will automatically synchronize the internal counters after a
	      system  reboot,  if enought time has passed since	the daemon was
	      previously running or if the internal counters are  clearly  out
	      of sync.

       -u, --user user
	      Set daemon process user to user during startup.  user can	be ei-
	      ther the login of	the user or a numerical	user id.  This	option
	      can only be used when the	process	is started as root.

       -v, --version
	      Show current version of the daemon executable.

       -?, --help
	      Show a command option summary.

       The  behaviour  of the daemon is	configured mainly using	the configura-
       tion keywords UpdateInterval, PollInterval and SaveInterval in the con-
       figuration file.

       UpdateInterval  defines	in  seconds  how  often	 the interface data is
       fetched and updated.  This is similar to	the run	interval for  alterna-
       tive  cron  based  updating.   However, the difference is that the data
       doesn't directly	get written to disk during updates.

       PollInterval defines in seconds how often the list of available	inter-
       faces  is  checked for possible changes.	The minimum value is 2 seconds
       and the maximum 60 seconds.  PollInterval also defines  the  resolution
       for other intervals.

       SaveInterval  defines  in  minutes  how	often cached interface data is
       written to disk.	 A write can only occur	during the updating of	inter-
       face  data. Therefore, the value	should be a multiple of	UpdateInterval
       with a maximum value of 60 minutes.

       The default values of UpdateInterval 30,	SaveInterval 5 and  PollInter-
       val  5  are usually suitable for	most systems and provide a similar be-
       haviour as cron based updating does but with a  better  resolution  for
       interface changes and fast interfaces.

       For  embedded  and/or  low  power systems more tuned configurations are
       possible.  In such cases	 if  the  interfaces  are  mostly  static  the
       PollInterval  can be increased to around	10-30 seconds and UpdateInter-
       val set to 60 seconds. Higher values up to 300 seconds are possible  if
       the  interface speed is 10 Mbit or less.	 SaveInterval can be increased
       for example to 15, 30 or	even 60	minutes	depending  on  how  often  the
       data needs to be	viewed.

       The daemon is listening to signals SIGHUP, SIGINT and SIGTERM.  Sending
       the SIGHUP signal to the	daemon will cause cached data to be written to
       disk,  a	rescan of the database directory and a reload of settings from
       the configuration file. However,	the pid	 file  location	 will  not  be
       changed even if it's configuration setting has been modified.

       SIGTERM	and  SIGINT  signals will cause	the daemon to write all	cached
       data to disk and	then exit.

	      Default database directory. Files	are  named  according  to  the
	      monitored	interfaces.

	      Config file that will be used unless $HOME/.vnstatrc exists. See
	      the configuration	chapter	and vnstat.conf(5) for	more  informa-

	      Log  file	 that will be used if logging to file is enable	and no
	      other file is specified in the config file.

	      File used	for storing the	process	id if no other file is	speci-
	      fied in the configuration	file or	using the command line parame-

       Updates needs to	be executed at least as	often as it  is	 possible  for
       the  interface to generate enough traffic to overflow the kernel	inter-
       face 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  GiB.	Calculated  theoretical	 times

	      10 Mbit:	      54 minutes
	      100 Mbit:	       5 minutes
	      1000 Mbit:      30 seconds

       However,	for 1000 Mbit interfaces updating once every minute is usually
       a usable	solution if faster updates can't be used.

       Virtual and aliased interfaces cannot 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.

       Teemu Toivola <tst at iki dot fi>

       vnstat(1), vnstati(1), vnstat.conf(5), signal(7)

version	1.15			 DECEMBER 2015			    VNSTATD(1)


Want to link to this manual page? Use this URL:

home | help