Mercurial > ~darius > hgwebdir.cgi > adslstats
comparison adslstats.py @ 13:bf46efd061d7
Remove debugging and restore RRD update
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Thu, 08 Jan 2015 11:28:28 +1030 |
parents | a6297e8a42a3 |
children | 2debc3fb4372 |
comparison
equal
deleted
inserted
replaced
12:a6297e8a42a3 | 13:bf46efd061d7 |
---|---|
308 stats = getdata() | 308 stats = getdata() |
309 if stats == None: | 309 if stats == None: |
310 if options.verbose: | 310 if options.verbose: |
311 print "Modem is offline" | 311 print "Modem is offline" |
312 | 312 |
313 if (options.update or options.munin) and stats != None: | 313 if (options.update or options.munin != None) and stats != None: |
314 if options.update: | 314 if options.update: |
315 try: | 315 try: |
316 os.stat(rrdname) | 316 os.stat(rrdname) |
317 except OSError, e: | 317 except OSError, e: |
318 if e.errno == 2: | 318 if e.errno == 2: |
319 print "rrd not found, creating.." | 319 print "rrd not found, creating.." |
320 makerrd(rrdname) | 320 makerrd(rrdname) |
321 | 321 updaterrd(rrdname, int(time.time()), stats) |
322 print '%d:%d:%d:%f:%f:%f:%f' % (int(time.time()), | |
323 stats.upstream, | |
324 stats.downstream, | |
325 stats.nmup, | |
326 stats.nmdown, | |
327 stats.attenup, | |
328 stats.attendown) | |
329 if options.munin != None: | 322 if options.munin != None: |
330 if options.munin == 'signal': | 323 if options.munin == 'signal': |
331 print '''noisemarginup.value %.1f | 324 print '''noisemarginup.value %.1f |
332 noisemargindown.value %.1f | 325 noisemargindown.value %.1f |
333 attenuationup.value %.1f | 326 attenuationup.value %.1f |