{"id":3281,"date":"2022-12-20T17:02:14","date_gmt":"2022-12-20T20:02:14","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/vnstatd-man8\/"},"modified":"2022-12-20T17:02:14","modified_gmt":"2022-12-20T20:02:14","slug":"vnstatd-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/vnstatd-man8\/","title":{"rendered":"VNSTATD (man8)"},"content":{"rendered":"<h1 align=\"center\">VNSTATD<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#CONFIGURATION\">CONFIGURATION<\/a><br \/> <a href=\"#SIGNALS\">SIGNALS<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#RESTRICTIONS\">RESTRICTIONS<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">vnstatd \u2212 daemon based database updating for vnStat<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>vnstatd<\/b> [<b>\u2212Ddnpsv?<\/b>] [<b>\u2212\u2212alwaysadd<\/b>] [<b>\u2212\u2212config<\/b> <i>file<\/i>] [<b>\u2212\u2212daemon<\/b>] [<b>\u2212\u2212debug<\/b>] [<b>\u2212g<\/b> <i>group<\/i>] [<b>\u2212\u2212group<\/b> <i>group<\/i>] [<b>\u2212\u2212help<\/b>] [<b>\u2212\u2212noadd<\/b>] [<b>\u2212\u2212nodaemon<\/b>] [<b>\u2212\u2212pidfile<\/b> <i>file<\/i>] [<b>\u2212\u2212sync<\/b>] [<b>\u2212\u2212u<\/b> <i>user<\/i>] [<b>\u2212\u2212user<\/b> <i>user<\/i>] [<b>\u2212\u2212version<\/b>]<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The purpose of <b>vnstatd<\/b> is to provide a flexible and robust way for updating the database that <b>vnstat<\/b>(1) uses. The availability of each interface is automatically tracked which removes the need for additional scripts to be implemented and called when an interface comes online or goes offline.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>vnstatd<\/b> is the command for starting the daemon. The daemon can either fork itself to run as a background process or stay attached to the terminal. It supports logging to a user selectable file or using syslog.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Once started, the daemon will read <b>vnstat.conf<\/b>(5) if available and then check if there is a database present in the database directory that has been specified in the configuration file. By default, if no database is found, a database will be created during startup with entries for all available interfaces excluding pseudo interfaces lo, lo0 and sit0. This automatic database entry creation behaviour can be disabled using the <b>&#8211;noadd<\/b> option. Alternatively, it is possible to allow the daemon to create new database entries whenever previously unseen interfaces become visible using the <b>&#8211;alwaysadd<\/b> option.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The daemon will proceed to track the availability of monitored interfaces, process the interface traffic statistics and write new values to the database at a configured interval. As a result, the daemon ends up spending most of the time sleeping between updates.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>&#8211;alwaysadd<\/b><\/p>\n<p style=\"margin-left:22%;\">Enable automatic creation of new database entries for previously unseen interfaces even if the database directory already contains a database when the daemon is started. New database entries will also get created for new interfaces seen while the daemon is running. Pseudo interfaces lo, lo0 and sit0 are excluded from getting added.<\/p>\n<p style=\"margin-left:11%;\"><b>&#8211;config<\/b> <i>file<\/i><\/p>\n<p style=\"margin-left:22%;\">Use <i>file<\/i> as configuration file instead of using automatic configuration file search functionality.<\/p>\n<p style=\"margin-left:11%;\"><b>-d, &#8211;daemon<\/b><\/p>\n<p style=\"margin-left:22%;\">Fork process to background and run as a daemon.<\/p>\n<p style=\"margin-left:11%;\"><b>-D, &#8211;debug<\/b><\/p>\n<p style=\"margin-left:22%;\">Provide additional output for debug purposes. The process will stay attached to the terminal for output.<\/p>\n<p style=\"margin-left:11%;\"><b>-g, &#8211;group<\/b> <i>group<\/i><\/p>\n<p style=\"margin-left:22%;\">Set daemon process group to <i>group<\/i> during startup. <i>group<\/i> can be either the name of the group or a numerical group id. This option can only be used when the process is started as root.<\/p>\n<p style=\"margin-left:11%;\"><b>&#8211;noadd<\/b><\/p>\n<p style=\"margin-left:22%;\">Disable automatic creation of new database entries for all available interfaces if the daemon is started with no database found. Pseudo interfaces lo, lo0 and sit0 are excluded from getting added.<\/p>\n<p style=\"margin-left:11%;\"><b>-n, &#8211;nodaemon<\/b><\/p>\n<p style=\"margin-left:22%;\">Stay in foreground attached to the current terminal and start the update process.<\/p>\n<p style=\"margin-left:11%;\"><b>-p, &#8211;pidfile<\/b> <i>file<\/i><\/p>\n<p style=\"margin-left:22%;\">Write the process id to <i>file<\/i> and use it for locking so that another instance of the daemon cannot be started if the same <i>file<\/i> is specified.<\/p>\n<p style=\"margin-left:11%;\"><b>-s, &#8211;sync<\/b><\/p>\n<p style=\"margin-left:22%;\">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 ignored. This option isn\u2019t required in normal use because the daemon will automatically synchronize the internal counters after a system reboot, if enough time has passed since the daemon was previously running or if the internal counters are clearly out of sync.<\/p>\n<p style=\"margin-left:11%;\"><b>-u, &#8211;user<\/b> <i>user<\/i><\/p>\n<p style=\"margin-left:22%;\">Set daemon process user to <i>user<\/i> during startup. <i>user<\/i> can be either the login of the user or a numerical user id. This option can only be used when the process is started as root.<\/p>\n<p style=\"margin-left:11%;\"><b>-v, &#8211;version<\/b><\/p>\n<p style=\"margin-left:22%;\">Show current version of the daemon executable.<\/p>\n<p style=\"margin-left:11%;\"><b>-?, &#8211;help<\/b><\/p>\n<p style=\"margin-left:22%;\">Show a command option summary.<\/p>\n<h2>CONFIGURATION <a name=\"CONFIGURATION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The behaviour of the daemon is configured mainly using the configuration keywords <b>UpdateInterval, PollInterval<\/b> and <b>SaveInterval<\/b> in the configuration file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>UpdateInterval<\/b> defines in seconds how often the interface data is fetched and updated. This is similar to the run interval for alternative cron based updating. However, the difference is that the data doesn\u2019t directly get written to disk during updates.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>PollInterval<\/b> defines in seconds how often the list of available interfaces is checked for possible changes. The minimum value is 2 seconds and the maximum 60 seconds. <b>PollInterval<\/b> also defines the resolution for other intervals.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>SaveInterval<\/b> defines in minutes how often cached interface data is written to disk. A write can only occur during the updating of interface data. Therefore, the value should be a multiple of <b>UpdateInterval<\/b> with a maximum value of 60 minutes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The default values of <b>UpdateInterval<\/b> 30, <b>SaveInterval<\/b> 5 and <b>PollInterval<\/b> 5 are usually suitable for most systems and provide a similar behaviour as cron based updating does but with a better resolution for interface changes and fast interfaces.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For embedded and\/or low power systems more tuned configurations are possible. In such cases if the interfaces are mostly static the <b>PollInterval<\/b> can be increased to around 10-30 seconds and <b>UpdateInterval<\/b> set to 60 seconds. Higher values up to 300 seconds are possible if the interface speed is 10 Mbit or less. <b>SaveInterval<\/b> can be increased for example to 15, 30 or even 60 minutes depending on how often the data needs to be viewed.<\/p>\n<h2>SIGNALS <a name=\"SIGNALS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The daemon is listening to signals <b>SIGHUP, SIGINT<\/b> and <b>SIGTERM.<\/b> Sending the <b>SIGHUP<\/b> 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\u2019s configuration setting has been modified.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>SIGTERM<\/b> and <b>SIGINT<\/b> signals will cause the daemon to write all cached data to disk and then exit.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>\/var\/lib\/vnstat\/<\/i><\/p>\n<p style=\"margin-left:22%;\">Default database directory.<\/p>\n<p style=\"margin-left:11%;\"><i>\/etc\/vnstat.conf<\/i><\/p>\n<p style=\"margin-left:22%;\">Config file that will be used unless <i>$HOME\/.vnstatrc<\/i> exists. See the configuration chapter and <b>vnstat.conf<\/b>(5) for more information.<\/p>\n<p style=\"margin-left:11%;\"><i>\/var\/log\/vnstat.log<\/i><\/p>\n<p style=\"margin-left:22%;\">Log file that will be used if logging to file is enable and no other file is specified in the config file.<\/p>\n<p style=\"margin-left:11%;\"><i>\/run\/vnstat\/vnstat.pid<\/i><\/p>\n<p style=\"margin-left:22%;\">File used for storing the process id if no other file is specified in the configuration file or using the command line parameter.<\/p>\n<h2>RESTRICTIONS <a name=\"RESTRICTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Updates need to be executed at least as often as it is possible for the interface to generate enough traffic to overflow the kernel interface traffic counter. Otherwise, it is possible that some traffic won\u2019t be seen. With 32-bit kernels, the maximum time between two updates depends on how fast the interface can transfer 4 GiB. Calculated theoretical times are:<\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><img decoding=\"async\" src=\"grohtml-1040101.png\" alt=\"Image grohtml-1040101.png\"><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">However, for 1000 Mbit interfaces updating once every minute is usually a usable solution if a shorter update interval can\u2019t be used.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Virtual and aliased interfaces cannot be monitored because the kernel doesn\u2019t 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.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Teemu Toivola <tst at iki dot fi><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>vnstat<\/b>(1), <b>vnstati<\/b>(1), <b>vnstat.conf<\/b>(5), <b>signal<\/b>(7)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  vnstatd \u2212 daemon based database updating for vnStat <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,414],"class_list":["post-3281","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-vnstatd"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3281"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3281\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}