comparison adslstats.py @ 17:43f54da8baf9

Add max sync speeds to munin (untested)
author Daniel O'Connor <darius@dons.net.au>
date Fri, 20 May 2016 15:18:59 +0930
parents 425d02592dce
children ec994073f70a
comparison
equal deleted inserted replaced
16:425d02592dce 17:43f54da8baf9
284 *signalargs) 284 *signalargs)
285 285
286 if __name__ == "__main__": 286 if __name__ == "__main__":
287 names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)'] 287 names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)']
288 if options.munin != None: 288 if options.munin != None:
289 # Handle the wrapper passing us $0 directly 289 # Handle the wrapper passing us its $0 as our $1
290 tmp = options.munin.split('_') 290 tmp = options.munin.split('_')
291 if len(tmp) > 1: 291 if len(tmp) > 1:
292 options.munin = tmp[-1] 292 options.munin = tmp[-1]
293 if options.munin not in ['signal', 'sync']: 293 if options.munin not in ['signal', 'sync']:
294 print "Unknown data type" 294 print "Unknown data type ", options.munin
295 sys.exit(1) 295 sys.exit(1)
296 if len(args) > 0: 296 if len(args) > 0:
297 if args[0] == 'config': 297 if args[0] == 'config':
298 if options.munin == 'signal': 298 if options.munin == 'signal':
299 print '''graph_category adsl 299 print '''graph_category adsl
311 graph_title DSL Sync Speed 311 graph_title DSL Sync Speed
312 graph_args --base 1024 -l 0 312 graph_args --base 1024 -l 0
313 graph_vlabel kbit/sec 313 graph_vlabel kbit/sec
314 up.label Up 314 up.label Up
315 up.type GAUGE 315 up.type GAUGE
316 up.max 24000 316 up.max 150000
317 up.min 0 317 up.min 0
318 down.label Down 318 down.label Down
319 down.type GAUGE 319 down.type GAUGE
320 down.max 24000 320 down.max 15000
321 down.min 0''' 321 down.min 0
322 upmax.label Up
323 upmax.type GAUGE
324 upmax.max 150000
325 upmax.min 0
326 downmax.label Down
327 downmax.type GAUGE
328 downmax.max 150000
329 downmax.min 0'''
322 sys.exit(0) 330 sys.exit(0)
323 if options.update or options.munin: 331 if options.update or options.munin:
324 stats = getdata() 332 stats = getdata()
325 if options.verbose: 333 if options.verbose:
326 if stats == None: 334 if stats == None:
341 print '''noisemarginup.value %.1f 349 print '''noisemarginup.value %.1f
342 noisemargindown.value %.1f 350 noisemargindown.value %.1f
343 attenuationup.value %.1f 351 attenuationup.value %.1f
344 attenuationdown.value %.1f''' % (stats.nmup, stats.nmdown, stats.attenup, stats.attendown) 352 attenuationdown.value %.1f''' % (stats.nmup, stats.nmdown, stats.attenup, stats.attendown)
345 elif options.munin == 'sync': 353 elif options.munin == 'sync':
346 print '''up.value %.1f 354 s = '''up.value %.1f
347 down.value %.1f''' % (stats.upstream, stats.downstream) 355 down.value %.1f\n''' % (stats.upstream, stats.downstream)
348 356 if hasattr(stats, 'upstreammax'):
357 s += '''upmax.value %.1f
358 downmax.value %.1f''' % (stats.upstreammax, stats.downstreammax)
359 print s
349 if options.graph: 360 if options.graph:
350 gengraph() 361 gengraph()
351 362