hallo
ich habe folgendes script was mir den traffic auf eth0 anzeigt.
problem ist nur ich kriege es nicht so hin das es mir den traffic von wlan0 anzeigt,
kann mir da jemand weiterhelfen ?
das script sieht wie folgt aus
Code
import time
lasttime = 1
lastin = 0
lastout = 0
def getspeed():
x = open('/proc/net/dev','r')
for line in x.readlines():
line = line.strip()
if (line[:4] == 'eth0'):
line = line[5:].split()
bin = int(line[0])
bout = int(line[8])
return (bin, bout)
while True:
z = getspeed()
timedelta = time.time()-lasttime
lasttime = time.time()
sin = (float(z[0]-lastin))/(1000000*timedelta)
sout = (float(z[1]-lastout))/(1000000*timedelta)
print ("IN: " + str(round(sin, 2)) + " MB/s"), (" OUT: " + str(round(sout, 2)) + " MB/s")
lastin = z[0]
lastout = z[1]
time.sleep(1)
Alles anzeigen
vielen dank schonmal im voraus
TwoCry