|
|
|
|
||||||
| linux.debian.user debian-user@lists.debian.org. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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)) |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
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----- |
|
![]() |
| Outils de la discussion | |
|
|