All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Bandwidth Monitor
@ 2003-08-01 16:50 Sebastián Aresca
  2003-08-02  4:28 ` Leonardo Balliache
  2003-08-02  9:13 ` Cristian Ionescu-Idbohrn
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastián Aresca @ 2003-08-01 16:50 UTC (permalink / raw)
  To: lartc

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 / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-02  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-01 16:50 [LARTC] Bandwidth Monitor Sebastián Aresca
2003-08-02  4:28 ` Leonardo Balliache
2003-08-02  9:13 ` Cristian Ionescu-Idbohrn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.