LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 08-09-2005, 06:56 PM   #1
RemusX2
Member
 
Registered: Oct 2003
Location: Bozeman, Montana
Distribution: Gentoo 2010, Ubuntu 9.04
Posts: 175

Rep: Reputation: 30
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
 
Old 08-09-2005, 07:20 PM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
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.
 
Old 08-09-2005, 07:45 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
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.
 
Old 10-15-2005, 02:59 PM   #4
watsoncj
LQ Newbie
 
Registered: Sep 2005
Location: Colorado
Distribution: Mandriva LE 2005
Posts: 12

Rep: Reputation: 0
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
 
Old 10-15-2005, 04:42 PM   #5
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bandwidth monitoring,,,,, apenguinlinux Linux - Software 3 01-25-2005 11:19 AM
Bandwidth Monitoring basketkase999 Linux - Software 2 01-13-2005 03:44 PM
Bandwidth monitoring vinhhv Linux - Networking 8 07-21-2003 05:12 AM
Bandwidth Monitoring syntac Linux - Networking 2 04-08-2003 03:17 AM
Bandwidth Monitoring allandire Linux - Networking 1 06-25-2002 07:02 AM


All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration