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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-29-2006, 04:23 AM
|
#1
|
|
Member
Registered: Oct 2003
Location: St Paul, MN
Distribution: Fedora 8, Fedora 9
Posts: 513
Rep:
|
Need software to monitor network usage
I use a broadband ADSL service that has a monthly usage cap. As my Linux machine generates most of the traffic, I would like to use it to monitor my usage.
Can anyone suggest some software that would be able to monitor my network usage?
Regards
David Gee
|
|
|
|
05-29-2006, 06:28 AM
|
#2
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
The newer ADSL modems hava a web interface that you can use to configure the modem. If you have one of these, somewhere in all those pages is a running tally of bytes uploaded/dowwnloaded since the last reset. Usually you can also reset the counters to zero (eg at the beginning of your accounting period). For my zoom X5, I click on Advanced Settings, then ATM Status, to see a whole load of statistics.
This has the advantage that it monitors your connection, rather than one specific machine.
HTH
|
|
|
|
05-29-2006, 05:27 PM
|
#3
|
|
Member
Registered: Oct 2003
Location: St Paul, MN
Distribution: Fedora 8, Fedora 9
Posts: 513
Original Poster
Rep:
|
Hadn't thought of that. The router does have a stats page, but it only shows packet counts, not byte counts, and as packets vary in size that's not overly useful, so I think it may have to be some software after all.
|
|
|
|
07-30-2006, 10:12 AM
|
#4
|
|
LQ Newbie
Registered: Jul 2006
Location: sheffield, uk
Distribution: fedora 14
Posts: 7
Rep:
|
Simple solution
I have this in /etc/ppp/ip-down.local:
Code:
#!/bin/sh
#
# ip-down.local - called to add stats to /var/log/net
#
# Sat Oct 8 16:12:58 BST 2005
#
echo `date; /sbin/ifconfig $1 |
sed -n '7s/([^)]*)//gp'` >> /var/log/net
It takes the RX/TX info from line seven of the ifconfig command for your ppp device and puts it into a logging file.
I use this command to display the totals:
Code:
#!/bin/sh
#
# netStats RE - display stats for RE in /var/log/net
#
# Sat Dec 17 16:03:48 GMT 2005
#
# usage - display usage message
#
usage () {
echo "Usage: $NAME [ RE ]"
exit 1
}
NAME=`basename $0`
if [ $# -lt 2 ]
then re=$1
else usage
fi
awk "/$re/"'{ rx += substr( $8, 7)
tx += substr( $10, 7)
}
END { rxm = rx / (1024 * 1024)
rxg = rxm / 1024
txm = tx / (1024 * 1024)
txg = txm / 1024
printf "RX: %0.1f Mb (%0.1f Gb) ", rxm, rxg
printf "TX: %0.1f Mb (%0.1f Gb)\n", txm, txg
}
' /var/log/net
For example:
Code:
$ netStats Jun
RX: 4941.2 Mb (4.8 Gb) TX: 489.1 Mb (0.5 Gb)
$
Hope this helps,
Peter
|
|
|
|
07-30-2006, 11:54 AM
|
#5
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Neat script Peter, and rather good for a "First post"! I am sure others will find it useful.
Welcome to LQ!
|
|
|
|
01-12-2007, 11:25 AM
|
#6
|
|
LQ Newbie
Registered: Jul 2006
Location: sheffield, uk
Distribution: fedora 14
Posts: 7
Rep:
|
Post Firestarter script
After I installed Firestarter the ip-down.local script stopped working, probably because firestarter destroys ppp0 when it closes down.
Here is the latest version:
Code:
#!/bin/sh
#
# ip-down.local - called to add stats to /var/log/net
#
# Fri Dec 29 20:19:37 GMT 2006
#
echo `date` RX bytes:$BYTES_RCVD TX bytes:$BYTES_SENT >> /var/log/net
Last edited by cmsps; 04-01-2011 at 01:37 PM.
Reason: bug spotted and fixed after five years!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:59 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
|
|