Results 1 to 9 of 9
aloha
got question: typing /sbin/ifconfig eth0 gets me info about the nic device eth0, among other stuff it is received packets (RX), and sent packets (TX) - cumulative since the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-24-2004 #1Just Joined!
- Join Date
- Jun 2004
- Location
- macedonia
- Posts
- 7
NIC logging - RX & TX counters
aloha

got question: typing /sbin/ifconfig eth0 gets me info about the nic device eth0, among other stuff it is received packets (RX), and sent packets (TX) - cumulative since the last initialization of eth0. also, there is field that tells me the received number of bytes - RX, sent number of bytes TX,also cumulative. my question is where can i see some more info especially eventual log files covering these statistics. i suppose it is somewhere written ha? i wasnt able to find, i need to do some diagnostics so i need this thing, tried googling but had no luck....
please advise
smiles
Darko
- 06-24-2004 #2
AFAIK, you can't get more detailed stats by default. There is probably a program/daemon that would do it. Try googling for ethernet stat monitor or something...I'll see what I can find later if you/someone else doesn't find a solution...off to work now.
"Time is an illusion. Lunchtime, doubly so."
~Douglas Adams, The Hitchhiker's Guide to the Galaxy
- 06-24-2004 #3Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Well, it isn't logged or anything by default, but it would be the easiest thing in the world to make a Perl script that does that:
Then just chmod that to 755 and put it in your /etc/cron.daily or similar, and you'll get one line per day in /tmp/logfile telling you the number of read and written bytes. That's the power of Perl for you. =)Code:#!/usr/bin/perl open IFC, "ifconfig eth0 |"; while(<IFC>) { if(($rb, $wb) = /RX bytes:\s*(\d*).*TX bytes:\s*(\d*)/) { last; } } close IFC; open LOG, ">>/tmp/logfile"; print LOG "$rb $wb\n"; close LOG;
- 06-24-2004 #4
And don't forget to run it when before you reboot/restart your ethernet controller.
BTW...I would've gotten to that...just was rushed for work this morning.
"Time is an illusion. Lunchtime, doubly so."
~Douglas Adams, The Hitchhiker's Guide to the Galaxy
- 06-25-2004 #5Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Seriously, Perl has to be the best utility language ever designed...
- 06-25-2004 #6Just Joined!
- Join Date
- Jun 2004
- Location
- macedonia
- Posts
- 7
so thats it ha? no detailed information or eventual log...
its just not clear to me about that perl script
- how do i set up to run before initializing the network interface?
- 06-25-2004 #7Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
If you copy it into /etc/cron.daily, cron will automatically run it once every hour (on most somewhat standard distros, at least). I'm not sure about your intention... was that what you wanted to know?
I'm not sure exactly what kind of "detailed information" you're referring to. Is there anything more you wish to know about your networking traffic?
- 06-25-2004 #8
If you want to run it before interface init, you can edit your rc script (assuming that you use one) that handles the initialization. But you don't want to run it before you initialize the interface...just before you RE-initialize it or restart it or shut it down. It can be accomplished the same way, just putting the call at a different point in the rc script.
"Time is an illusion. Lunchtime, doubly so."
~Douglas Adams, The Hitchhiker's Guide to the Galaxy
- 06-29-2004 #9Just Joined!
- Join Date
- Jun 2004
- Location
- macedonia
- Posts
- 7
thanks!

by detailed i meant the same my initial question...where does the interface memorize the traffic sums for RX and TX while enabled/up


Reply With Quote
