Mercurial > ~darius > hgwebdir.cgi > adslstats
diff 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 |
line wrap: on
line diff
--- a/adslstats.py Fri May 20 15:09:03 2016 +0930 +++ b/adslstats.py Fri May 20 15:18:59 2016 +0930 @@ -286,12 +286,12 @@ if __name__ == "__main__": names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)'] if options.munin != None: - # Handle the wrapper passing us $0 directly + # Handle the wrapper passing us its $0 as our $1 tmp = options.munin.split('_') if len(tmp) > 1: options.munin = tmp[-1] if options.munin not in ['signal', 'sync']: - print "Unknown data type" + print "Unknown data type ", options.munin sys.exit(1) if len(args) > 0: if args[0] == 'config': @@ -313,12 +313,20 @@ graph_vlabel kbit/sec up.label Up up.type GAUGE -up.max 24000 +up.max 150000 up.min 0 down.label Down down.type GAUGE -down.max 24000 -down.min 0''' +down.max 15000 +down.min 0 +upmax.label Up +upmax.type GAUGE +upmax.max 150000 +upmax.min 0 +downmax.label Down +downmax.type GAUGE +downmax.max 150000 +downmax.min 0''' sys.exit(0) if options.update or options.munin: stats = getdata() @@ -343,9 +351,12 @@ attenuationup.value %.1f attenuationdown.value %.1f''' % (stats.nmup, stats.nmdown, stats.attenup, stats.attendown) elif options.munin == 'sync': - print '''up.value %.1f -down.value %.1f''' % (stats.upstream, stats.downstream) - + s = '''up.value %.1f +down.value %.1f\n''' % (stats.upstream, stats.downstream) + if hasattr(stats, 'upstreammax'): + s += '''upmax.value %.1f +downmax.value %.1f''' % (stats.upstreammax, stats.downstreammax) + print s if options.graph: gengraph()