vnStat

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources regardless of network traffic rate. This program is open source / GPL'ed and can be installed either as root or as a single user. Better instructions are included in the README. Feel free to send comments by email (remove the spamfilter) or try contacting me from irc (Vergo @ IRCNet).

Features

quick and simple to install and get running

gathered statistics persists through system reboots

can monitor multiple interfaces at the same time

several output options summary, 5 minute, hourly, daily, monthly, weekly, yearly, top days optional png image output (using libgd)

data retention duration is fully user configurable on the fly

months can be configured to follow billing period

light, minimal resource usage

same low cpu usage regardless of traffic

can be used without root permissions

online color configuration editor

Downloads

vnstat-2.6.tar.gz (sig) - source for Linux and BSD (269.3 KiB) Man pages: vnstat [html] [pdf] [ps] vnstatd [html] [pdf] [ps] vnstati [html] [pdf] [ps] vnstat.conf [html] [pdf] [ps] CHANGES - changelog FAQ - Frequently Asked Questions image output demo

Git repository: github.com/vergoh/vnstat Latest development version: master.zip



Links

Similar programs: ntop

darkstat

MRTG

bwm-ng

iftop

IPTraf vnStat related: vnstat-dashboard

the following lack support for version 2.x: jsvnstat vnStat PHP frontend vnStat SVG frontend VnstatSystrayIcon (Windows)



Screenshots

Since vnStat doesn't have/need a fancy GUI, all 'screenshots' are console captures. Examples of the image output can be found from the cgi demo page.

$ vnstat --help vnStat 2.6 by Teemu Toivola -5, --fiveminutes [limit] show 5 minutes -h, --hours [limit] show hours -hg, --hoursgraph show hours graph -d, --days [limit] show days -m, --months [limit] show months -y, --years [limit] show years -t, --top [limit] show top days -b, --begin set list begin date -e, --end set list end date --oneline [mode] show simple parsable format --json [mode] [limit] show database in json format --xml [mode] [limit] show database in xml format -tr, --traffic [time] calculate traffic -l, --live [mode] show transfer rate in real time -i, --iface select interface (default: eth0) Use "--longhelp" or "man vnstat" for complete list of options.

$ vnstat Database updated: 2018-10-21 20:11:20 eth0 since 2010-12-16 rx: 144.21 GB tx: 380.53 GB total: 524.74 GB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2018-09 1.82 GB | 7.99 GB | 9.81 GB | 32.52 kbit/s 2018-10 1.71 GB | 7.64 GB | 9.35 GB | 44.80 kbit/s ------------------------+-------------+-------------+--------------- estimated 2.56 GB | 11.41 GB | 13.97 GB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- yesterday 72.69 MB | 333.94 MB | 406.63 MB | 39.48 kbit/s today 67.21 MB | 279.75 MB | 346.96 MB | 40.05 kbit/s ------------------------+-------------+-------------+--------------- estimated 79.92 MB | 332.65 MB | 412.57 MB |

(with 2 interfaces) $ vnstat rx / tx / total / estimated Internet (eth1): 2018-09 31.90 GiB / 28.05 GiB / 59.95 GiB 2018-10 281.04 MiB / 99.45 MiB / 380.49 MiB / 12.05 GiB yesterday 1.23 GiB / 473.23 MiB / 1.69 GiB today 281.04 MiB / 99.45 MiB / 380.49 MiB / 397 MiB Local (eth0): 2018-09 25.13 GiB / 116.94 GiB / 142.07 GiB 2018-10 234.75 MiB / 5.03 GiB / 5.26 GiB / 170.76 GiB yesterday 520.55 MiB / 2.21 GiB / 2.72 GiB today 234.75 MiB / 5.03 GiB / 5.26 GiB / 5.51 GiB

$ vnstat -5 eth0 / 5 minute time rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2018-10-21 18:15 237.54 KB | 960.80 KB | 1.17 MB | 32.72 kbit/s 18:20 248.26 KB | 1.03 MB | 1.27 MB | 35.61 kbit/s 18:25 178.42 KB | 940.01 KB | 1.09 MB | 30.54 kbit/s 18:30 201.54 KB | 0.98 MB | 1.18 MB | 32.87 kbit/s 18:35 188.62 KB | 926.50 KB | 1.09 MB | 30.45 kbit/s 18:40 191.09 KB | 946.02 KB | 1.11 MB | 31.05 kbit/s 18:45 173.85 KB | 862.77 KB | 1.01 MB | 28.31 kbit/s 18:50 182.20 KB | 930.16 KB | 1.09 MB | 30.37 kbit/s 18:55 194.74 KB | 944.66 KB | 1.11 MB | 31.11 kbit/s 19:00 192.85 KB | 901.06 KB | 1.07 MB | 29.87 kbit/s 19:05 180.64 KB | 878.76 KB | 1.03 MB | 28.93 kbit/s 19:10 206.94 KB | 1.01 MB | 1.21 MB | 33.94 kbit/s 19:15 198.73 KB | 961.37 KB | 1.13 MB | 31.68 kbit/s 19:20 195.19 KB | 909.28 KB | 1.08 MB | 30.16 kbit/s 19:25 204.65 KB | 1.18 MB | 1.38 MB | 38.56 kbit/s 19:30 207.78 KB | 1.04 MB | 1.24 MB | 34.62 kbit/s 19:35 200.50 KB | 970.48 KB | 1.14 MB | 31.98 kbit/s 19:40 214.45 KB | 1.46 MB | 1.67 MB | 46.77 kbit/s 19:45 193.93 KB | 1.11 MB | 1.30 MB | 36.26 kbit/s 19:50 190.28 KB | 908.45 KB | 1.07 MB | 30.00 kbit/s 19:55 199.20 KB | 1.12 MB | 1.31 MB | 36.74 kbit/s 20:00 8.43 MB | 1.35 MB | 9.78 MB | 273.50 kbit/s 20:05 364.31 KB | 1.12 MB | 1.48 MB | 41.34 kbit/s 20:10 153.84 KB | 870.70 KB | 1.00 MB | 27.98 kbit/s ------------------------+-------------+-------------+---------------

$ vnstat -h eth0 / hourly hour rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2018-10-20 21:00 3.03 MB | 12.05 MB | 15.08 MB | 35.14 kbit/s 22:00 2.68 MB | 14.12 MB | 16.79 MB | 39.13 kbit/s 23:00 2.80 MB | 13.89 MB | 16.69 MB | 38.90 kbit/s 2018-10-21 00:00 3.18 MB | 12.54 MB | 15.72 MB | 36.62 kbit/s 01:00 2.60 MB | 12.90 MB | 15.50 MB | 36.12 kbit/s 02:00 2.62 MB | 15.07 MB | 17.69 MB | 41.21 kbit/s 03:00 2.87 MB | 13.36 MB | 16.23 MB | 37.81 kbit/s 04:00 2.45 MB | 12.05 MB | 14.50 MB | 33.79 kbit/s 05:00 3.55 MB | 31.13 MB | 34.68 MB | 80.82 kbit/s 06:00 7.76 MB | 13.98 MB | 21.74 MB | 50.65 kbit/s 07:00 2.57 MB | 11.67 MB | 14.24 MB | 33.18 kbit/s 08:00 2.29 MB | 11.62 MB | 13.91 MB | 32.42 kbit/s 09:00 2.93 MB | 13.33 MB | 16.26 MB | 37.89 kbit/s 10:00 2.24 MB | 12.13 MB | 14.37 MB | 33.49 kbit/s 11:00 2.36 MB | 13.25 MB | 15.61 MB | 36.38 kbit/s 12:00 3.03 MB | 13.16 MB | 16.19 MB | 37.73 kbit/s 13:00 2.40 MB | 15.30 MB | 17.70 MB | 41.25 kbit/s 14:00 2.51 MB | 14.56 MB | 17.07 MB | 39.78 kbit/s 15:00 3.11 MB | 12.23 MB | 15.34 MB | 35.75 kbit/s 16:00 2.37 MB | 12.60 MB | 14.97 MB | 34.89 kbit/s 17:00 2.29 MB | 11.76 MB | 14.04 MB | 32.73 kbit/s 18:00 2.83 MB | 11.45 MB | 14.28 MB | 33.28 kbit/s 19:00 2.33 MB | 12.32 MB | 14.65 MB | 34.12 kbit/s 20:00 8.93 MB | 3.33 MB | 12.26 MB | 151.25 kbit/s ------------------------+-------------+-------------+---------------

$ vnstat -hg eth0 19:36 ^ t | t | t | t | rt t t t | t rt t t t t t t | t t t t t t t rt t t t t t t t t t t | t t t t t t t t t t rt t t t t t t t t t t t t t | t t t t t t t t t t rt t t t t t t t t t t t t t | t rt t t rt t t rt t t rt rt t rt rt t rt rt t rt rt t rt rt -+---------------------------------------------------------------------------> | 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 h rx (KB) tx (KB) ][ h rx (KB) tx (KB) ][ h rx (KB) tx (KB) 20 1,245 6,079 ][ 04 1,186 5,193 ][ 12 2,301 8,135 21 1,671 5,245 ][ 05 1,303 6,999 ][ 13 1,512 9,351 22 1,177 6,188 ][ 06 9,530 14,294 ][ 14 1,319 7,273 23 1,393 7,301 ][ 07 1,453 6,760 ][ 15 1,482 5,061 00 1,451 4,850 ][ 08 1,352 7,066 ][ 16 1,473 8,597 01 1,355 6,632 ][ 09 1,588 4,843 ][ 17 987 4,314 02 1,385 6,757 ][ 10 1,535 9,041 ][ 18 1,896 7,099 03 1,678 6,225 ][ 11 1,411 8,035 ][ 19 2,014 6,373

$ vnstat -d eth0 / daily day rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2018-09-22 56.08 MB | 195.26 MB | 251.34 MB | 24.40 kbit/s 2018-09-23 49.19 MB | 184.96 MB | 234.14 MB | 22.73 kbit/s 2018-09-24 50.95 MB | 204.30 MB | 255.25 MB | 24.78 kbit/s 2018-09-25 50.35 MB | 460.20 MB | 510.55 MB | 49.57 kbit/s 2018-09-26 63.73 MB | 239.20 MB | 302.93 MB | 29.41 kbit/s 2018-09-27 62.47 MB | 263.74 MB | 326.21 MB | 31.67 kbit/s 2018-09-28 61.12 MB | 232.71 MB | 293.83 MB | 28.53 kbit/s 2018-09-29 88.82 MB | 342.20 MB | 431.02 MB | 41.85 kbit/s 2018-09-30 110.91 MB | 337.91 MB | 448.82 MB | 43.58 kbit/s 2018-10-01 82.42 MB | 609.21 MB | 691.63 MB | 67.15 kbit/s 2018-10-02 82.93 MB | 307.30 MB | 390.23 MB | 37.89 kbit/s 2018-10-03 89.81 MB | 340.29 MB | 430.10 MB | 41.76 kbit/s 2018-10-04 88.03 MB | 336.77 MB | 424.80 MB | 41.24 kbit/s 2018-10-05 85.95 MB | 323.02 MB | 408.96 MB | 39.71 kbit/s 2018-10-06 81.83 MB | 329.06 MB | 410.89 MB | 39.89 kbit/s 2018-10-07 102.80 MB | 310.33 MB | 413.13 MB | 40.11 kbit/s 2018-10-08 88.10 MB | 642.48 MB | 730.59 MB | 70.93 kbit/s 2018-10-09 83.71 MB | 322.94 MB | 406.65 MB | 39.48 kbit/s 2018-10-10 81.53 MB | 326.35 MB | 407.88 MB | 39.60 kbit/s 2018-10-11 82.14 MB | 332.01 MB | 414.15 MB | 40.21 kbit/s 2018-10-12 102.39 MB | 371.90 MB | 474.29 MB | 46.05 kbit/s 2018-10-13 85.11 MB | 351.10 MB | 436.21 MB | 42.35 kbit/s 2018-10-14 81.11 MB | 330.21 MB | 411.32 MB | 39.93 kbit/s 2018-10-15 74.10 MB | 322.71 MB | 396.81 MB | 38.53 kbit/s 2018-10-16 87.69 MB | 649.75 MB | 737.45 MB | 71.60 kbit/s 2018-10-17 79.95 MB | 349.15 MB | 429.10 MB | 41.66 kbit/s 2018-10-18 76.85 MB | 332.82 MB | 409.67 MB | 39.77 kbit/s 2018-10-19 77.90 MB | 323.81 MB | 401.72 MB | 39.00 kbit/s 2018-10-20 72.69 MB | 333.94 MB | 406.63 MB | 39.48 kbit/s 2018-10-21 67.21 MB | 279.75 MB | 346.96 MB | 40.05 kbit/s ------------------------+-------------+-------------+--------------- estimated 79.92 MB | 332.65 MB | 412.57 MB |

$ vnstat -m eth0 / monthly month rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2017-11 1.05 GB | 4.32 GB | 5.37 GB | 17.78 kbit/s 2017-12 893.89 MB | 3.68 GB | 4.55 GB | 14.60 kbit/s 2018-01 1.14 GB | 5.10 GB | 6.24 GB | 20.01 kbit/s 2018-02 1.21 GB | 4.93 GB | 6.14 GB | 21.80 kbit/s 2018-03 1.23 GB | 5.64 GB | 6.87 GB | 22.03 kbit/s 2018-04 1.15 GB | 5.22 GB | 6.37 GB | 21.11 kbit/s 2018-05 1.23 GB | 4.39 GB | 5.62 GB | 18.04 kbit/s 2018-06 2.68 GB | 7.01 GB | 9.69 GB | 32.10 kbit/s 2018-07 1.61 GB | 6.94 GB | 8.55 GB | 27.41 kbit/s 2018-08 1.76 GB | 7.65 GB | 9.41 GB | 30.19 kbit/s 2018-09 1.82 GB | 7.99 GB | 9.81 GB | 32.52 kbit/s 2018-10 1.71 GB | 7.64 GB | 9.35 GB | 44.80 kbit/s ------------------------+-------------+-------------+--------------- estimated 2.56 GB | 11.41 GB | 13.97 GB |

$ vnstat -t eth0 / top 10 # day rx | tx | total | avg. rate -----------------------------+-------------+-------------+--------------- 1 2012-08-06 150.68 MB | 5.24 GB | 5.39 GB | 535.76 kbit/s 2 2013-09-06 887.33 MB | 4.33 GB | 5.20 GB | 516.75 kbit/s 3 2013-03-30 3.15 GB | 1.99 GB | 5.14 GB | 510.67 kbit/s 4 2012-08-05 97.85 MB | 3.29 GB | 3.39 GB | 336.90 kbit/s 5 2018-06-17 1.01 GB | 1.80 GB | 2.81 GB | 279.48 kbit/s 6 2011-08-20 1.61 GB | 676.60 MB | 2.27 GB | 225.88 kbit/s 7 2015-05-10 76.77 MB | 2.12 GB | 2.20 GB | 218.47 kbit/s 8 2011-12-04 1.36 GB | 633.59 MB | 1.98 GB | 197.10 kbit/s 9 2014-04-27 175.73 MB | 1.57 GB | 1.74 GB | 173.07 kbit/s 10 2014-04-26 177.37 MB | 1.53 GB | 1.71 GB | 169.75 kbit/s -----------------------------+-------------+-------------+---------------

$ vnstat -tr 3103 packets sampled in 5 seconds Traffic average for eth1 rx 50.41 KiB/s 289 packets/s tx 82.11 KiB/s 331 packets/s

$ vnstat -l Monitoring eth0... (press CTRL-C to stop) rx: 0 kbit/s 1 p/s tx: 4 kbit/s 2 p/s eth0 / traffic statistics rx | tx --------------------------------------+------------------ bytes 21 KiB | 36 KiB --------------------------------------+------------------ max 60 kbit/s | 72 kbit/s average 3.36 kbit/s | 5.76 kbit/s min 0 kbit/s | 0 kbit/s --------------------------------------+------------------ packets 262 | 272 --------------------------------------+------------------ max 94 p/s | 94 p/s average 5 p/s | 5 p/s min 0 p/s | 0 p/s --------------------------------------+------------------ time 50 seconds



