-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript3.py
36 lines (32 loc) · 1.17 KB
/
script3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import time
import urllib2
import re
import copy
#Pas de temps en sec
step = 30
#Duree totale de l'analyse en sec
duree = 18000
suivi = open("suivifree.txt", "a")
suivi.write("Date - Protocole - Debit (kb/s) - SNR(dB) - attenuation(dB)- FEC - CRC - HEC \n")# % (date, debit))#, snr, FEC, CRC, HEC))
suivi.close
print 'Debut'
i=0
while i <duree/30:
brut = urllib2.urlopen('http://192.168.0.254/pub/fbx_info.txt')
contenu = brut.read()
debit = re.search(".*ATM.*", contenu).group().split()[2]
prot = re.search(".*Protocole.*", contenu).group().split()
prot.append('')
protocole = prot[1]
snr = re.search(".*Marge de bruit.*", contenu).group().split()[3]
attenuation = re.search(".*nuation.*", contenu).group().split()[1]
FEC = re.search(".*FEC.*", contenu).group().split()[1]
CRC = re.search(".*CRC.*", contenu).group().split()[1]
HEC = re.search(".*HEC.*", contenu).group().split()[1]
date = time.strftime("%c")#"%Y %m %d %H %%http %M %S")
suivi = open("suivifree.txt", "a")
suivi.write("%s - %s - %s - %s - %s - %s - %s - %s\n" % (date, protocole, debit, snr, attenuation, FEC, CRC, HEC))
suivi.close
time.sleep(step)
i+=1
print("Fin")