Skip to contentSkip to conversation

Bandwidth Monitor

LARTC Sebastián Aresca 3 participants 3 messages Aug 1, 2003 – Aug 2, 2003

lore
Share & tools
lore
#0 lore raw

Anybody knows about one bandwidth meter to use in Bering. This is a script i built, it's works wel, but it's not very nice!!! =P

#!/bin/bash

# Bandwidth Monitor

device=eth0

bytes=grep $device /proc/net/dev | cut -f 2 -d : | cut -d ' ' -f 2 kbytes=expr $bytes / 1024
actual=$kbytes

i=1
x=0
total=0
while [ $i -le 2 ]
do

    x=`expr $x + 1`
    bytes=`grep $device /proc/net/dev |  cut -f 2 -d : | cut -d ' ' -f 2`
    kbytes=`expr $bytes / 1024`
    valor=`expr $kbytes - $actual`
    actual=$kbytes

    if [ $x =  5 ]
    then
        x=2
        total=$promedio
    fi

    total=`expr $total + $valor`
    promedio=`expr $total / $x`

    echo actual: [$valor Kb/s] - promedio: [$promedio Kb/s]
    sleep 1

done

Best regards.

Sebastián A. Aresca

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

Hi,

Have a look at
http://ldp.kernelnotes.de/HOWTO/Querying-libiptc-HOWTO/bmeter.html

Best regards,

Leonardo Balliache

Quoted 38 lines · you

Anybody knows about one bandwidth meter to use in Bering. This is a script i built, it's works wel, but it's not very nice!!! =P

#!/bin/bash

# Bandwidth Monitor

device=eth0

bytes=grep $device /proc/net/dev | cut -f 2 -d : | cut -d ' ' -f 2 kbytes=expr $bytes / 1024
actual=$kbytes

i=1
x=0
total=0
while [ $i -le 2 ]
do

    x=`expr $x + 1`
    bytes=`grep $device /proc/net/dev |  cut -f 2 -d : | cut -d ' ' -f 2`
    kbytes=`expr $bytes / 1024`
    valor=`expr $kbytes - $actual`
    actual=$kbytes

    if [ $x =  5 ]
    then
        x=2
        total=$promedio
    fi

    total=`expr $total + $valor`
    promedio=`expr $total / $x`

    echo actual: [$valor Kb/s] - promedio: [$promedio Kb/s]
    sleep 1

done

Quoted 7 lines

Best regards.

Sebastián A. Aresca

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

Practical QoS
http://opalsoft.net/qos

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#2 lore raw
In reply to Sebastián Aresca
Quoted 1 line · On Fri, 1 Aug 2003, [iso-8859-1] Sebastián Aresca wrote:

Anybody knows about one bandwidth meter to use in Bering.

You might want give nanotop a try. It shows a line like this:

CPU: [=- ] MEM: 8.8MB LAN: 1.0kB/s(RX) 454.00B/s(TX) 0(ERR

Dynamically built and stripped, the executable file size is about 5k.

The home page:

http://floppyfw.wojci.dk/nanotop.phtml

Cheers,
Cristian
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/