Hi
Nice.
Is the call of the -u option timecritical for the hourly statistik ??
A few words and maybe a crond file would be cool.
Greets
Hi,
I compiled vnstat (network traffic monitor) for latest firmware (1.9.2.7). Maybe some1 wants it too? Stripped it down to 147 kb. Vnstat can do monthly to hourly accounting and has a simple ascii graph interface.
Vnstat home
I changed the default path for storing data to /tmp/harddisk/lib/vnstat. Soon it will have HTML output, looking forward to that!
Last edited by Rob ter Veer; 21-12-2004 at 16:56.
Hi
Nice.
Is the call of the -u option timecritical for the hourly statistik ??
A few words and maybe a crond file would be cool.
Greets
My Stuff: WL-500g, Mapower H31x 10GB HD, Philips Webcam Vesta PRO, TerraTec Webcam PRO, USB Hub
Okaye.. Here's some more info.. Sorry about that:
Cron entry:
0-55/5 * * * * /tmp/harddisk/bin/vnstat -u
Extracted manpage:
NAME
vnStat - a console-based network traffic monitor
SYNOPSIS
vnstat [ -Ddhmqrstuvw? ] [ -i interface ] [ -tr time ] [ --cleartop ]
[ --days ] [ --debug ] [ --disable ] [ --dumpdb ] [ --enable ] [ --help
] [ --hours ] [ --iface interface ] [ --longhelp ] [ --months ] [
--nick nickname ] [ --query ] [ --rebuildtotal ] [ --reset ] [ --short
] [ --testkernel ] [ --top10 ] [ --traffic time ] [ --update ] [ --ver-
sion ] [ --weeks ]
DESCRIPTION
vnStat is a console-base network traffic monitor that keeps a log of
daily and monthly network traffic for the selected interface(s). How-
ever, it isn't a packet sniffer. The traffic information is analyzed
from the proc(5) -filesystem, so that vnStat can be used without root
permissions.
OPTIONS
-D, --debug
Show additional debug output.
-d, --days
Show traffic for days.
-h, --hours
Show traffic for the last 24 hours.
-i, --iface interface
Select one specific interface and apply actions to only it.
-m, --months
Show traffic for months.
-q, --query
Force database query mode.
-r, --reset
Reset the internal counters in the database for the selected
interface. Use this if the interface goes down and back up, oth-
erwise that interface will get some extra traffic to its data-
base.
-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.
-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.
-u, --update
Update all enabled databases or only the one specified with -i
parameter.
-v, --version
Show current version.
-w, --weeks
Show traffic for 7 days, current and previous week.
--cleartop
Remove all top10 entries.
--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 or perl 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.
--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.
-?, --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.
--rebuildtotal
Reset the total traffic counters and recount those using
recorded months.
--testkernel
Test if the kernel btime stays always to same like it should or
if it's shifting.
FILES
/tmp/harddisk/lib/vnstat
This directory contains all databases the program uses. Files
are named according to the monitored interfaces.
EXAMPLES
vnstat -u -i interface forces a database update for interface or cre-
ates the database if it doesn't exist. This is usually the first com-
mand used after a fresh install.
vnstat -u -i interface --nick nick gives interface the nickname nick
and that information will be later included with queries.
vnstat -u -r --disable -i interface resets the internal counters of
interface and disables it from being updated before enabled again with
the --enable parameter. This feature is especially useful for inter-
faces like ppp0 that aren't always active.
RESTRICTIONS
Estimated traffic values are likely to be somewhat inaccurate if daily
traffic is low because only the MB counter is used to calculate the
estimate.
AUTHOR
Teemu Toivola <tst at iki dot fi>
Last edited by Rob ter Veer; 21-12-2004 at 18:18.
HI,
I would like to use this VNSTAT - it is perfect for me - but -
I tried it and sometimes add a lot of MB to statistic more. But this traffic wasn't.
Is it any bug in VNSTAT?
IS possible fix it?
Thanks very much
Now I know where is the bug about.
The problem is in /proc/stat where isn't static btime until next reboot.
So i think is necessary to recompile vnstat and change
/* how much the boot time can variate between updates (seconds) */
#define BVAR "15" to increase number cca "100"
in file vnstat.h.
Can you anybody recompile vnstat for asus?
http://humdi.net/vnstat/
thanks very much
I have commited vnstat in http://trac.nslu2-linux.org/optware/changeset/5246
Any patch needded?
Hi oleo,
now I don't understant, have you vnstat (mipsel) compiled for asus?
I would need to compile vnstat but with one change:
change in file vnstat.h #define BVAR "15" to #define BVAR "100"
because on asus in /proc/stat is btime chaging more then 15 second(vnstat is add a lot MB more than really was)
I am newbie in linux so I don't know how to compile it. I tried it along http://www.nslu2-linux.org/wiki/FAQ/Optware-uClibcBuild but mission impossible
sorry for my poor english
thanks
Last edited by greengreen; 21-01-2007 at 18:55.
thanks very much
but how can I run vnstatr with this patch?
Is possible to compile whole vnstat with this patch - like vnstat from Rob ter Veer?
thx
ipkg install vnstat
ok I tried but
[root@asus root]$ ipkg install vnstat
Installing vnstat (1.4-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/un...4-1_mipsel.ipk
Configuring vnstat
Successfully terminated.
[root@asus root]$ vnstat
-sh: vnstat: not found
how to run it?
maybe it is to do for bash and no for sh
yes it is for bash-could you change it
and could you change please yet:
/* location of the database directory */
#define DATABASEDIR "/var/lib/vnstat"
in file vnstat.h to /opt/var/vnstat?(because of space of ram. In /opt can be flash disk)
thanks very much I think it could be all.
Last edited by greengreen; 21-01-2007 at 20:27.
vnstat patchlevel -3 includes both changes to header. See
http://trac.nslu2-linux.org/optware/changeset/5255
Hi oleo,
now is great.
Is possible to compile it for shell sh too?
Now it works only for shell bash witch isn't defautl shell in oleg's firmware.
I will test it.
thanks very much.
hi,
I don't know how but now Vnstat woks in shell sh too
It was my bug about.
Very thanks for your work oleo.
thanks
Hi Oleo,
is possible to compile new version of vnstat with same changes(patches for asus) like version 1.4?
thanks a lot