CONTENT
  • CHANGES
Szukaj
counter

#top vnstat


vnstat - a console-based network traffic monitor

Powiązane:
iostat, mpstat, vmstat, vnstat

SYNOPSIS
vnstat [ -Ddhlmqrstuvw? ] [ -i interface ] [ -tr time ] [ --cleartop ] [ --config file ] [ --days ] [ --debug ] [ --disable ] [ --dumpdb ] [ --enable ] [ --help ] [ --hours ] [ --iface interface ] [ --live ] [ --longhelp ] [ --months ] [ --nick nickname ] [ --query ] [ --rebuildtotal ] [ --reset ] [ --short ] [ --showconfig ] [ --testkernel ] [ --top10 ] [ --traffic time ] [ --update ] [ --version ] [ --weeks ]


DESCRIPTION



OPTIONS
-d, --days
Show traffic for days.

-h, --hours
Show traffic for the last 24 hours.

-m, --months
Show traffic for months.

-s, --short
Use short output mode. This mode is also used if more than one database is available.

-t, --top10
Show all time top10 traffic days.

-w, --weeks
Show traffic for 7 days, current and previous week.

-tr time
Calculate how much traffic goes through the selected interface during the given time seconds. The time will be 5 seconds if a number parameter isn't included.

-l, --live
Display current transfer rate for the selected interface in real time until interrupted. Statistics will be shown after interruption if runtime was more than 10 seconds.

-i, --iface interface
Select one specific interface and apply actions to only it.

-q, --query
Force database query mode.

-u, --update
Update all enabled databases or only the one specified with -i parameter.

-r, --reset
Reset the internal counters in the database for the selected interface. Use this if the interface goes down and back up, otherwise that interface will get some extra traffic to its database.

--sync Synchronize
internal counters in the database with interface counters for the selected interface. Use this if the system is rebooted but interface counters aren't reseted. Such can occur when suspend to ram/disk is used.

--enable, --disable
Enable or disable updates for selected interface. Useful for interfaces that aren't always available, like ppp0. If the interface goes down it should be disabled in order to avoid errors. Add something like vnstat -r --disable -i ppp0 to the script that's executed when the interface goes down and vnstat --enable -i ppp0 to the up script.

-v, --version
Show current version.

--cleartop
Remove all top10 entries.

-?, --help
Show a command summary.

--longhelp
Show complete options list.

--nick nickname
Set the selected interfaces nickname as an alias the will be displayed in queries. Usage of -u is required to save the change.

--config file
Use file as config file instead of using normal config file search function.

--rebuildtotal
Reset the total traffic counters and recount those using recorded months.

--testkernel
Test if the kernel boot time information always stays the same like it should or if it's shifting.

-D, --debug
Show additional debug output.

--dumpdb
Instead of showing the database with a formated output, this output will dump the whole database in a format that should be easy to parse with most script languages. Use this for example with PHP, Perl or Python to make a custom webpage. The dump uses ; as field delimeter.

active;1 activity status
interface;eth0 name for the interface
nick;inet nick (if given)
created;1023895272 creation date in Unix time
updated;1065467100 when the database was updated
totalrx;569605 all time total received MB
totaltx;2023708 all time total transmitted MB
currx;621673719 latest rx value in /proc
curtx;981730184 latest tx value in /proc
totalrxk;644 total rx kB counter
totaltxk;494 total tx kB counter
btime;1059414541 system boot time in Unix time

Then follows 30 lines like the following

d;0;1078696800;559;7433;68;557;1

where d = days, 0 = day number in database (0 is today), 1077314401 date in Unix time, 559 = rx MB, 7433 = tx MB, 68 = rx kB, 557 = tx kB and 1 tells that vnStat has filled this value and it is in use.

m;0;1078092000;48649;139704;527;252;1 (x12)
t;0;1078351200;5979;47155;362;525;1 (x10)
h;0;1078699800;118265;516545 (x24)

m = months, t = top10 and h = hours, all other fields are in the same order as in days except hours that doesn't have a separate kB value. For hours the forth and fifth fields have values in kB.



EXAMPLES
vnstat --help
 vnStat 1.6 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
         -l,  --live           show transfer rate in real time

See also "--longhelp" for complete options list and "man vnstat".

vnstat --longhelp
 vnStat 1.6 by Teemu Toivola <tst at iki dot fi>

   Update:
         -u, --update          update database
         -r, --reset           reset interface counters
         --sync                sync interface counters
         --enable              enable interface
         --disable             disable interface
         --nick                set a nickname for interface
         --cleartop            clear the top10
         --rebuildtotal        rebuild total transfers from months
   Query:
         -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
         --dumpdb              show database in parseable format
   Misc:
         -i,  --iface          select interface (default: eth0)
         -?,  --help           short help
         -D,  --debug          show some additional debug information
         -v,  --version        show version
         -tr, --traffic        calculate traffic
         -l,  --live           show transfer rate in real time
         --config              select used config file
         --showconfig          dump config file with current settings
         --testkernel          check if the kernel is broken
         --longhelp            display this help

See also "man vnstat".



vnstat --update -i lo
vnstat --update -i eth0
chown -R vnstat:vnstat /var/lib/vnstat/
ll -a /var/lib/vnstat/

total 160
drwxr-xr-x.  2 vnstat vnstat 4096 2014-05-05 06:56 ./
drwxr-xr-x. 41 root   root   4096 2014-04-18 09:49 ../
-rw-r--r--.  1 vnstat vnstat 2792 2014-05-20 00:05 eth0
-rw-r--r--.  1 vnstat vnstat 2792 2014-05-20 00:05 .eth0
-rw-r--r--.  1 vnstat vnstat 2792 2014-05-20 00:05 lo
-rw-r--r--.  1 vnstat vnstat 2792 2014-05-20 00:05 .lo
[...]

vnstat -h
vnstat -d
vnstat -w
vnstat -m
vnstat -h -i eth0
vnstat -d -i eth0
vnstat -w -i eth0
vnstat -m -i eth0

> czy zna ktos statystyki generowane np co 5 min, ale wyswietlane przez
> www w postaci tekstu, htmla, php. bez uzycia rrdtool.
vnstat + coś lekkiego do wystawiania danych przez http. to drugie można załatwić np. za pomocą perla lub thttpd.




Zmodyfikowany ostatnio: 2015/11/18 00:03:54 (8 lat temu), textsize: 9,39 kB, htmlsize: 10,9 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników