vnstatd

Network traffic statistics collection daemon

TLDR

Start the daemon
$ sudo systemctl start vnstat
Enable at boot
$ sudo systemctl enable vnstat
Run daemon in foreground
$ vnstatd -n
Run with debug output
$ vnstatd -D
Sync database and exit
$ vnstatd --sync

SYNOPSIS

vnstatd [options]

DESCRIPTION

vnstatd is the daemon component of vnStat that collects network traffic statistics. It reads interface counters from the kernel at configured intervals and stores data in a persistent database.The daemon tracks multiple interfaces simultaneously, recording 5-minute, hourly, daily, monthly, and yearly statistics. It automatically detects new interfaces added to the database without requiring restart.Resource usage is minimal since vnstatd reads kernel counters rather than capturing packets. Data persists across reboots, making it suitable for long-term bandwidth monitoring.

PARAMETERS

-d, --daemon

Fork to background as daemon.
-n, --nodaemon
Stay in foreground.
-s, --sync
Sync cached data to database and exit.
-D, --debug
Enable debug output.
--config file
Use specified config file.
-p, --pidfile file
Use specified PID file.
--noadd
Don't add new interfaces automatically.
-v, --version
Display version.

CONFIGURATION

Config file: /etc/vnstat.confKey settings include monitored interfaces, database location, update interval, and data retention periods.

INSTALL

sudo apt install vnstat
sudo dnf install vnstat
sudo pacman -S vnstat
sudo apk add vnstat
sudo zypper install vnstat
brew install vnstat
nix profile install nixpkgs#vnstat

CAVEATS

Statistics begin from daemon start, not historically. Kernel counter resets (reboots, interface changes) may cause inaccuracies. Database corruption possible on unclean shutdown.

HISTORY

vnstatd is part of vnStat, created by Teemu Toivola for lightweight network traffic monitoring. The project began in 2002 and has become a standard tool for bandwidth monitoring on Linux servers and embedded systems.

SEE ALSO

vnstat(1), vnstati(1), iftop(8), nethogs(8)