PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > bandwidth tool
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

bandwidth tool

Réponse
 
LinkBack Outils de la discussion
Vieux 05/07/2008, 21h50   #1
Mag Gam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
Vieux 05/07/2008, 22h20   #2
Michael Marsh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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
  Réponse avec citation
Vieux 06/07/2008, 04h20   #3
Owen Townend
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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
  Réponse avec citation
Vieux 06/07/2008, 16h00   #4
Raj Kiran Grandhi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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\n" % (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)+"\n")
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))
  Réponse avec citation
Vieux 07/07/2008, 17h00   #5
M. Piscaer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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
  Réponse avec citation
Vieux 08/07/2008, 01h00   #6
Mag Gam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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
  Réponse avec citation
Vieux 08/07/2008, 04h00   #7
T o n g
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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/...ngle/index.htm

HTH


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 12/07/2008, 08h30   #8
David Barrett
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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
  Réponse avec citation
Vieux 26/07/2008, 04h00   #9
Julian De Marchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: 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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIiopOfM8nSo1lmBQRAt0pAKCnqihWUTpYXGEpZovI5l 7PYyZhXACeLQVQ
oF+AMJ6vkXirRrw8aOuNyPo=
=tMDy
-----END PGP SIGNATURE-----

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h20.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,22249 seconds with 17 queries