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.
vnStat is good alternative for Cacti /rrdtool /mrtg :)
Install
apt-get install vnstat
yum install vnstat
Parameters
# vnstat --help vnStat 1.14 by Teemu Toivola <tst at iki dot fi> -q, --query query database -h, --hours show hours -d, --days show days -m, --months show months -w, --weeks show weeks -t, --top10 show top 10 days -s, --short use short output -u, --update update database -i, --iface select interface (default: eth0) -?, --help short help -v, --version show version -tr, --traffic calculate traffic -ru, --rateunit swap configured rate unit -l, --live show transfer rate in real time See also "--longhelp" for complete options list and "man vnstat".
Default report
$ vnstat Database updated: Sat Dec 17 12:33:38 2016 eth0 since 12/16/16 rx: 1.47 GiB tx: 860.82 MiB total: 2.31 GiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Dec '16 1.47 GiB | 860.82 MiB | 2.31 GiB | 13.59 kbit/s ------------------------+-------------+-------------+--------------- estimated 2.76 GiB | 1.58 GiB | 4.33 GiB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- yesterday 767.22 MiB | 757.96 MiB | 1.49 GiB | 144.61 kbit/s today 739.54 MiB | 102.86 MiB | 842.40 MiB | 152.62 kbit/s ------------------------+-------------+-------------+--------------- estimated 1.38 GiB | 195 MiB | 1.57 GiB |
show hours
# vnstat -h eth0 10:35 ^ t | t t t t | t t t t t | t t t t t t t t | t t t t t t t t t t | t t t t t t t t t t t t 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 t t rt rt t t t t t t t t t | rt t t t rt rt rt rt rt rt t t t t t t t rt rt t -+---------------------------------------------------------------------------> | 11 12 13 14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 h rx (MiB) tx (MiB) h rx (MiB) tx (MiB) h rx (MiB) tx (MiB) 11 3,146.49 19,386.77 19 5,491.50 29,854.40 03 389.85 2,170.27 12 3,002.60 17,897.40 20 4,916.31 23,892.57 04 490.96 4,020.57 13 2,886.97 17,895.09 21 2,852.26 16,816.08 05 785.89 4,993.61 14 3,013.67 22,344.94 22 1,750.06 9,529.99 06 1,736.40 9,789.96 15 5,888.83 28,785.71 23 985.60 4,617.60 07 2,488.29 13,386.74 16 4,946.38 30,282.41 00 376.42 2,023.85 08 3,650.32 18,664.20 17 9,944.24 26,298.65 01 297.14 1,423.57 09 3,888.19 22,367.94 18 6,580.22 28,808.68 02 162.31 793.37 10 2,898.04 15,172.47
show transfer rate in real time
# vnstat -l Monitoring eth0... (press CTRL-C to stop) rx: 758 kbit/s 1617 p/s tx: 77.68 Mbit/s 268 p/s^C eth0 / traffic statistics rx | tx --------------------------------------+------------------ bytes 7.66 MiB | 126.10 MiB --------------------------------------+------------------ max 6.96 Mbit/s | 415.35 Mbit/s average 3.49 Mbit/s | 57.39 Mbit/s min 448 kbit/s | 182 kbit/s --------------------------------------+------------------ packets 39391 | 6916 --------------------------------------+------------------ max 14291 p/s | 1566 p/s average 2188 p/s | 384 p/s min 245 p/s | 129 p/s --------------------------------------+------------------ time 18 seconds
Leave a Reply