Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-09-2005, 06:56 PM
|
#1
|
Member
Registered: Oct 2003
Location: Bozeman, Montana
Distribution: Gentoo 2010, Ubuntu 9.04
Posts: 175
Rep:
|
Monitoring Bandwidth
I will be heading off to live in the dorms in about 2 weeks and was informed that they monitor the bandwidth pretty heavily. 2GB d/l per day is what they say they allow roughly. Is there a way to monitor how much data I have transfered in a day? I would like to stay as close to my 2GB limit as possible because I'm paying for the connection so might as well use it. Thanks
Remus
|
|
|
08-09-2005, 07:20 PM
|
#2
|
Member
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827
Rep:
|
ifconfig itself shows sent(TX) and recieved(RX) bytes since the connection was acquired, so if you dont keep your machine on 24/7, or reset your connection every 24 hours, this would make a simle way of monitoring it:
Code:
ifconfig | grep RX | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1
That snippet will get you the info you want neatly.. Ofcourse there is prolly some nifty program for better monitoring, but hey, thats what search engines are for, right? (;
edit:
Put up quicly a nicer output and interface to that quick grepping.. Its set up so that if you give any parameter at all, also the second interface is shown, if no parameter is given, only the first is shown. Just to show you an idea:
Code:
#!/bin/bash
echo -n "|eth0|"
echo -n " down: "
echo -n $(ifconfig | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1 | head -n 1)
echo -n " | up: "
ifconfig | grep bytes | cut -d "(" -f 3 | cut -d ")" -f 1 | head -n 1
if [ ! -z $1 ]; then
echo -n "|eth1|"
echo -n " down: "
echo -n $(ifconfig | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1 | head -n 2 | tail -n 1)
echo -n " | up: "
ifconfig | grep bytes | cut -d "(" -f 3 | cut -d ")" -f 1 | head -n 2 | tail -n 1
fi
Last edited by Artanicus; 08-09-2005 at 07:35 PM.
|
|
|
08-09-2005, 07:45 PM
|
#3
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
Not as nice as a script, and I'm not even sure of the accuracy,
but with GkrellM you can hover your mouse over the eth0
(or appropriate) NIC display window, and a small rectangle will
appear in the bottom right of that area. Then just click on the
rectangle and you will get a window pop up with statistics for
Daily, Weekly, and Monthly received, transmitted, and total.
|
|
|
10-15-2005, 02:59 PM
|
#4
|
LQ Newbie
Registered: Sep 2005
Location: Colorado
Distribution: Mandriva LE 2005
Posts: 12
Rep:
|
This info is available in /proc/net/dev but it is pretty hard to read as is. Running it through something like the following can clean it up. But it still needs some work.
Code:
awk '/eth0/ {print "Rx total:",$2,"b\nTx total:",$10,"b"}' /proc/net/dev
|
|
|
10-15-2005, 04:42 PM
|
#5
|
Member
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116
Rep:
|
GKrellM has a lot more configurability and can keep track of your usage over the course of a month or a week, regardless of restarts. Of course you could just as easily write up a script to keep a daily, weekly, and/or monthly total in a log somewhere.
Get creative, and be sure to let us know what you come up with.
|
|
|
All times are GMT -5. The time now is 09:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|