Skip to content

Instantly share code, notes, and snippets.

@koheyamada
Last active March 8, 2016 02:39
Show Gist options
  • Save koheyamada/0d12a719b526917b6f02 to your computer and use it in GitHub Desktop.
Save koheyamada/0d12a719b526917b6f02 to your computer and use it in GitHub Desktop.
vnstatで手軽にtrafiicをモニタリング ref: http://qiita.com/kooohei/items/d4b29be4541cec5018c6
$ vnstat -u -i eth0
Error: Unable to read database "/var/lib/vnstat/eth0".
Info: -> A new database has been created.
$ vnstat --help
vnStat 1.11 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 top10
-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".
$ vnstat -w
eth0 / weekly
rx | tx | total | avg. rate
---------------------------+-------------+-------------+---------------
last 7 days 25 KiB | 13 KiB | 38 KiB | 0.00 kbit/s
current week 25 KiB | 13 KiB | 38 KiB | 0.00 kbit/s
---------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
$ sudo yum install --enablerepo=epel vnstat
$ sudo apt-get install vnstat vnstati
$ vnstati -vs -o ./hsum.png
$ vnstat -u -i eth0
$ sudo service vnstat start
vnstatd を起動中: [ OK ]
$ vnstat
Database updated: Tue Jul 7 15:16:40 2015
eth0 since 07/07/15
rx: 25 KiB tx: 13 KiB total: 38 KiB
monthly
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
Jul '15 25 KiB | 13 KiB | 38 KiB | 0.00 kbit/s
------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
daily
rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
today 25 KiB | 13 KiB | 38 KiB | 0.01 kbit/s
------------------------+-------------+-------------+---------------
estimated -- | -- | -- |
$ ls /var/lib/vnstat/
eth0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment