FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-05-2008, 08:40 PM
"Mag Gam"
 
Default bandwidth tool

Is there a tool to measure network traffic? I am using ifstat but its reporting wrong statistics. I am trying to get something similar to

eth0 , 16Mb/sec
eth1,* 10Mb/sec

etc..

I need something simple :-)


TIA
 
Old 07-05-2008, 09:15 PM
"Michael Marsh"
 
Default bandwidth tool

On Sat, Jul 5, 2008 at 4:40 PM, Mag Gam <magawake@gmail.com> wrote:
> Is there a tool to measure network traffic? I am using ifstat but its
> reporting wrong statistics. I am trying to get something similar to
>
> eth0 , 16Mb/sec
> eth1, 10Mb/sec
>
> etc..
>
> I need something simple :-)

"bing" is pretty simple. You have to specify the endpoints, though,
so you'll need to know IP addresses from traceroute or something
similar.

--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com
http://36pints.blogspot.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-06-2008, 01:38 AM
 
Default bandwidth tool

>
>
>
>---- Original Message ----
>From: magawake@gmail.com
>To: debian-user@lists.debian.org
>Subject: RE: bandwidth tool
>Date: Sat, 5 Jul 2008 16:40:59 -0400
>
>>Is there a tool to measure network traffic? I am using ifstat but
>its
>>reporting wrong statistics. I am trying to get something similar to
>>
>>eth0 , 16Mb/sec
>>eth1, 10Mb/sec
>>
>>etc..
>>
>>I need something simple :-)
>>
>>TIA

Try Ethereal
Larry
>>




--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-06-2008, 03:17 AM
"Owen Townend"
 
Default bandwidth tool

On 06/07/2008, Mag Gam <magawake@gmail.com> wrote:
> Is there a tool to measure network traffic? I am using ifstat but its
> reporting wrong statistics. I am trying to get something similar to
>
> eth0 , 16Mb/sec
> eth1, 10Mb/sec
>
> etc..
>
> I need something simple :-)
>
> TIA
>

Hey,

Try 'iftop' if you just want network details.
There's a screenshot here: http://ex-parrot.com/~pdw/iftop/

or 'atop' if you want to have network and disk stats along with processes.
Screenshots: http://www.atcomputing.nl/Tools/atop/screenshots.html

cheers,
Owen.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-06-2008, 02:50 PM
Raj Kiran Grandhi
 
Default bandwidth tool

Mag Gam wrote:
Is there a tool to measure network traffic? I am using ifstat but its
reporting wrong statistics. I am trying to get something similar to


eth0 , 16Mb/sec
eth1, 10Mb/sec

etc..

I need something simple :-)


I needed something like that, and I finally ended up writing a small
python script (see attachment) that reads from
/sys/class/net/<iface>/statistics and computes the rates. Works for me.
YMMV.


HTH,
Raj Kiran


--

If you can't explain it simply, you don't understand it well enough.
-- Albert Einstein
#!/usr/bin/python
# Copyright © 2008 Raj Kiran Grandhi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys, time, os, signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

class Status: pass

def get_status(interface):
s = Status()
path = "/sys/class/net/%s/statistics/" % interface
file = open(path + "tx_bytes")
s.tx_bytes = int(file.readline().strip())
file.close()

file = open(path + "rx_bytes")
s.rx_bytes = int(file.readline().strip())
file.close()

file = open(path + "tx_packets")
s.tx_packets = int(file.readline().strip())
file.close()

file = open(path + "rx_packets")
s.rx_packets = int(file.readline().strip())
file.close()
return s

def human(rate):
if rate < 1024:
return "%d B/s" % rate
if rate < 1024*1024:
return "%5.1f kB/s" % (rate/1024.0)
if rate < 1024*1024*1024:
return "%5.1f MB/s" % (rate/(1024.0*1024.0))
else:
return "%5.1f GB/s" % (rate/(1024*1024*1024.0))

devices = sorted(os.listdir("/sys/class/net"))
if len(sys.argv) > 1:
devices = sys.argv[1:]

status_queue = {}
t_start = time.time()
for dev in devices:
status_queue[dev] = []
status_queue[dev].append(get_status(dev))

interval = 1
num_run = 5
print "".center(80,'-')
print "Device".center(20) + "Download(curr/avg)".center(24) +"".center(8)+ "Upload(curr/avg)".center(24)
print "".center(20)+"Current".center(12)+"/"+"5sec Avg".center(12)+"".center(8)+"Current".center(12)+ "/"+"5sec Avg".center(12)
print "".center(80,'-')
time.sleep(interval)
while True:
t_current = time.time()
for dev in devices:
status_queue[dev].append(get_status(dev))
s_old = status_queue[dev][-2]
s_curr = status_queue[dev][-1]
s_start = status_queue[dev][0]
s_first = status_queue[dev][1]
rate_in = s_curr.rx_bytes - s_old.rx_bytes + 0.0
rate_out = s_curr.tx_bytes - s_old.tx_bytes + 0.0
rate_in_avg = (s_curr.rx_bytes - s_start.rx_bytes)/(t_current - t_start)
rate_out_avg = (s_curr.tx_bytes - s_start.tx_bytes)/(t_current - t_start)
delta = len(status_queue[dev])-2
if delta >= num_run:
rate_in_run = float(s_curr.rx_bytes - s_first.rx_bytes)/delta
rate_out_run = float(s_curr.tx_bytes - s_first.tx_bytes)/delta
else:
rate_in_run = rate_in_avg
rate_out_run = rate_out_avg

# sys.stdout.write("%16.2f%16.2f%16.2f
" % (rate_in, rate_in_avg, rate_in_run))
sys.stdout.write(dev.center(20)+human(rate_in).cen ter(12)+"/"+
human(rate_in_run).center(12)+"".center(8)+
human(rate_out).center(12)+"/"+
human(rate_out_run).center(12)+"
")
sys.stdout.flush()
if len(status_queue[dev]) > num_run+1:
del status_queue[dev][1]
# print "%s: in:%8.2f kbps out: %8.2f kbps" % (dev, rate_in/1024.0, rate_out/1024.0)
time.sleep(interval)
sys.stdout.write("[%dA" % len(devices))
 
Old 07-07-2008, 03:03 PM
"M. Piscaer"
 
Default bandwidth tool

Mag Gam schreef:
Is there a tool to measure network traffic? I am using ifstat but its
reporting wrong statistics. I am trying to get something similar to


eth0 , 16Mb/sec
eth1, 10Mb/sec

etc..

I need something simple :-)

TIA


I use nload. It gives you an grafic of the past half minute.

Regards,

Michiel Piscaer


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-07-2008, 11:57 PM
"Mag Gam"
 
Default bandwidth tool

Well,

I need something realtime and accurate.

Any thoughts?

TIA

On Mon, Jul 7, 2008 at 11:03 AM, M. Piscaer <debian@masterpe.nl> wrote:
> Mag Gam schreef:
>>
>> Is there a tool to measure network traffic? I am using ifstat but its
>> reporting wrong statistics. I am trying to get something similar to
>>
>> eth0 , 16Mb/sec
>> eth1, 10Mb/sec
>>
>> etc..
>>
>> I need something simple :-)
>>
>> TIA
>>
> I use nload. It gives you an grafic of the past half minute.
>
> Regards,
>
> Michiel Piscaer
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject
> of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-08-2008, 02:52 AM
T o n g
 
Default bandwidth tool

On Sun, 06 Jul 2008 20:20:13 +0530, Raj Kiran Grandhi wrote:

>> Is there a tool to measure network traffic? I am using ifstat but its
>> reporting wrong statistics. I am trying to get something similar to
>>
>> eth0 , 16Mb/sec
>> eth1, 10Mb/sec
>>
>> etc..
>>
>> I need something simple :-)
>
> I needed something like that, and I finally ended up writing a small
> python script (see attachment) that reads from
> /sys/class/net/<iface>/statistics and computes the rates.

There is a Debian package doing exactly that, called,

ethstats - script that quickly measures network device throughput.

It reports Mb/s In, Mb/s Out and even p/s In & p/s Out. You can filter the
output or change the Perl code directly.

Ref:

Network Bandwidth Monitoring
http://xpt.sourceforge.net/techdocs/nix/conn/general/conn09-NetworkBandwidthMonitoring/single/index.htm

HTH


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-12-2008, 07:20 AM
David Barrett
 
Default bandwidth tool

Owen Townend wrote:

On 06/07/2008, Mag Gam <magawake@gmail.com> wrote:

Is there a tool to measure network traffic? I am using ifstat but its
reporting wrong statistics. I am trying to get something similar to

eth0 , 16Mb/sec
eth1, 10Mb/sec

etc..

I need something simple :-)

TIA



Hey,

Try 'iftop' if you just want network details.
There's a screenshot here: http://ex-parrot.com/~pdw/iftop/


iftop is amazing. Thanks for the tip!

-david


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-26-2008, 02:22 AM
Julian De Marchi
 
Default bandwidth tool

On Sat, Jul 05, 2008 at 04:40:59PM -0400, Mag Gam wrote:
> Is there a tool to measure network traffic? I am using ifstat but its
> reporting wrong statistics. I am trying to get something similar to
>
> eth0 , 16Mb/sec
> eth1, 10Mb/sec

Bit late of a reply, but ntop should do what you want.

---
Cheers,
Julian De Marchi
--
OpenNIC user - http://www.opennicproject.org/ | http://www.opennic.glue
Support OpenNIC and become a member today!
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
 

Thread Tools




All times are GMT. The time now is 10:03 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org