comparison adslstats.py @ 6:671e66da2cb9

Fix check for modem being connected. Fix cut & paste error making the line rates 1/10th what they should be.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 08 Feb 2014 09:19:20 +1030
parents 072489c80c51
children 98d351a87043
comparison
equal deleted inserted replaced
5:072489c80c51 6:671e66da2cb9
104 assert a[i].td.contents[0] == statsdict[i] 104 assert a[i].td.contents[0] == statsdict[i]
105 105
106 stats = ADSLStats() 106 stats = ADSLStats()
107 107
108 # Check if the modem is offline 108 # Check if the modem is offline
109 if a[3].td.contents[0] != 'Up': 109 if a[3].td.findNext('td').contents[0] != 'Up':
110 return None 110 return None
111 111
112 # dB 112 # dB
113 stats.nmdown = float(a[8].td.findNext('td').contents[0]) / 10.0 113 stats.nmdown = float(a[8].td.findNext('td').contents[0]) / 10.0
114 stats.nmup = float(a[8].td.findNext('td').findNext('td').contents[0]) / 10.0 114 stats.nmup = float(a[8].td.findNext('td').findNext('td').contents[0]) / 10.0
115 stats.attendown = float(a[9].td.findNext('td').contents[0]) / 10.0 115 stats.attendown = float(a[9].td.findNext('td').contents[0]) / 10.0
116 stats.attenup = float(a[9].td.findNext('td').findNext('td').contents[0]) / 10.0 116 stats.attenup = float(a[9].td.findNext('td').findNext('td').contents[0]) / 10.0
117 # kBit 117 # kBit
118 stats.upstream = float(a[14].td.findNext('td').contents[0]) / 10.0 118 stats.upstream = float(a[14].td.findNext('td').contents[0])
119 stats.downstream = float(a[14].td.findNext('td').findNext('td').contents[0]) / 10.0 119 stats.downstream = float(a[14].td.findNext('td').findNext('td').contents[0])
120 120
121 return stats 121 return stats
122 122
123 # Setup RRD 123 # Setup RRD
124 # We expect data to be logged every 5 minutes 124 # We expect data to be logged every 5 minutes