Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Internet] traffic consumption
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Cereza
Guru
Guru


Joined: 14 Apr 2006
Posts: 428

PostPosted: Mon May 14, 2007 11:08 pm    Post subject: [Internet] traffic consumption Reply with quote

Hello. My internet conection is limitated per 1gb traffic at month. I need to spend it carefully so it is very important for me to control the amount of MB I upload/download. I was searching in portage but I didn't find any program which counts that. I only find lots programas that count the speed, but not the totally amount of internet traffic to know on every moment the consumption I do. Does anyone knows a program which do that?

Thank you very much and sorry for my english.


Last edited by Cereza on Thu Jun 19, 2008 7:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
user118696
Apprentice
Apprentice


Joined: 16 Sep 2005
Posts: 276

PostPosted: Mon May 14, 2007 11:16 pm    Post subject: Reply with quote

vnstat does exactly this. It's in the Portage tree.
http://humdi.net/vnstat/
Back to top
View user's profile Send private message
mdeininger
Veteran
Veteran


Joined: 15 Jun 2005
Posts: 1740
Location: Emerald Isles, observing Dublin's docklands

PostPosted: Mon May 14, 2007 11:21 pm    Post subject: Reply with quote

while you're at it you might want to consider installing a proxy like squid and surf through that. using a proxy with aggressive caching can reduce your download traffic quite a lot. :) (helps better than browser caches, especially if you share the connection with others, 'cause then everyone can use the same proxy and thus the same cache)
_________________
"Confident, lazy, cocky, dead." -- Felix Jongleur, Otherland

( Twitter | Blog | GitHub )
Back to top
View user's profile Send private message
Cereza
Guru
Guru


Joined: 14 Apr 2006
Posts: 428

PostPosted: Mon May 14, 2007 11:59 pm    Post subject: Reply with quote

Thank you both very much :)) it will be so helpful for me.

pascal.bolduc wrote:
vnstat does exactly this. It's in the Portage tree.
http://humdi.net/vnstat/


It seems I didn't search as well as I have to do...
Back to top
View user's profile Send private message
Cereza
Guru
Guru


Joined: 14 Apr 2006
Posts: 428

PostPosted: Tue May 15, 2007 10:49 am    Post subject: Reply with quote

I have a little problem with vnstat today, yesterday it seems to work fine, I consumed about 7MB until I disconected, but today, just after connect it says:

vnstat wrote:
pelusilla@gentoo ~ $ vnstat -u
Database updated: Tue May 15 12:46:29 2007

ppp0

received: 4061 MB (49.8%)
transmitted: 4095 MB (50.2%)
total: 8156 MB

rx | tx | total
-----------------------+------------+-----------
today 4061 MB | 4095 MB | 8156 MB
-----------------------+------------+-----------
estimated 7634 MB | 7698 MB | 15332 MB


Wow that is impossible, it was disconnected, I don't know the cause of this, but in that way vnstat is unusable.
Back to top
View user's profile Send private message
user118696
Apprentice
Apprentice


Joined: 16 Sep 2005
Posts: 276

PostPosted: Wed May 16, 2007 12:20 am    Post subject: Reply with quote

From the vnstat FAQ :

Code:
2. Does vnStat work for PPPOE users?

 Although I haven't tested it, it's been reported to work
 if the supplied ppp scripts are installed correctly. As
 always, see the README and the man page.


Code:
7. Why does vnStat show sometimes multiple GB of traffic although
my network connection can't even transfer that much?
     OR
Each update adds the complete amount of traffic and 'vnstat -u -D'
claims that the system has been rebooted between updates.

 That's most likely a broken kernel. Run with --testkernel
 (version 1.2+ required) and see the result. See the next question
 for some explanation.
Back to top
View user's profile Send private message
Cereza
Guru
Guru


Joined: 14 Apr 2006
Posts: 428

PostPosted: Wed May 16, 2007 6:12 pm    Post subject: Reply with quote

I was in contact with developer of vnstat and he gave me the solution for vnstat on Gentoo:

Quote:
The problem is partly with the
use of a ppp device (I have to use one too so I know the problem) and
partly with the Gentoo install script. That install script doesn't properly
install all additional files that come with the original vnstat package and
manages to forget the install of everything related to ppp.

I'm not using Gentoo anymore but I still have a backup of my old /etc
archived. Things might have changed in later Gentoo version so don't take
these instructions by the letter. :)

First see if there are files called ip-down and ip-up in the /etc/ppp
directory. Those files should probably be there in all versions of Gentoo.
Next check if the those files contain lines like

(ip-down)
[ -f /etc/ppp/ip-down.local ] && . /etc/ppp/ip-down.local "$@"

(ip-up)
[ -f /etc/ppp/ip-up.local ] && . /etc/ppp/ip-up.local "$@"

If those kind of lines are missing then add them. The first one to the end
of ip-down and the second to the end of ip-up. Next open /etc/ppp/ip-up.local
and add if missing

if [ -x /usr/bin/vnstat ] && [ -w /var/lib/vnstat/$1 ]; then /usr/bin/vnstat -r --enable -i $1; fi

as one line. If the file was missing then start it with "#!/bin/sh". Next
see /etc/ppp/ip-down.local and add

if [ -x /usr/bin/vnstat ] && [ -w /var/lib/vnstat/$1 ]; then /usr/bin/vnstat --disable -i $1; fi

as one line there too. Same thing as previously with the creation of that
file.

The idea of these changes is to give vnStat information when ppp0 goes
down and up. Without that information vnStat will assume that the 32bit
traffic counter has wrapped since the previous update and give you much
extra traffic like witnessed.



The files /etc/ppp/ip-down and /etc/ppp/ip-up exits, and they were right, but /etc/ppp/ip-up.local and /etc/ppp/ip-down.local weren't created by compiling vnstat with emerge so I created them just how he said and now vnstat works perfectly. He said in addition:

Quote:
I think that the way Gentoo handles ppp is somewhat wrong. In other
distributions there are two directories, ip-up.d and ip-down.d
under /etc/ppp that will get all script file run after interface events.
When the directory is structured that way it's much more easier for install
scripts to just add a file into a directory instead of trying to edit two
files that can contain lines from other installed programs.

Feel free to forward this information to the Gentoo forums, it's anyway
already included in the documentation files that come with vnStat, although
not in a Gentoo specific way. The current install script in portage for
vnStat has also other weaknesses but after trying to get those fixed with
no luck (see the bugs.gentoo.org history for vnstat and story about cron
entries) and since I've moved to Ubuntu I haven't seen fixing Gentoo
portage maintainer issues as a priority anymore.

Btw, if you're using vixie-cron and the vnstat cron entry went
to /etc/cron.hourly then you might want to consider
removing /etc/cron.hourly/vnstat* and adding the following line
to /etc/cron.d/vnstat

0-55/5 * * * * root if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi

(one long line again). That will make vnStat update once every 5 minute
like it should and not once every hour like the Gentoo installer forces it
to do.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum