comparison adslstats.py @ 30:08cddcdb0db3

fix Munin plugin
author Daniel O'Connor <darius@dons.net.au>
date Fri, 27 Sep 2019 14:45:09 +0930
parents 607111929e2e
children 39bf6dec0753
comparison
equal deleted inserted replaced
29:e73e4677f873 30:08cddcdb0db3
73 help='Hostname of modem') 73 help='Hostname of modem')
74 parser.add_argument('-b', '--base', action='store', 74 parser.add_argument('-b', '--base', action='store',
75 help='Base directory for RRD & PNGs') 75 help='Base directory for RRD & PNGs')
76 parser.add_argument('-c', '--cookiejar', action='store', 76 parser.add_argument('-c', '--cookiejar', action='store',
77 help='Location of cookiejar') 77 help='Location of cookiejar')
78 parser.add_argument('rest', nargs = '*')
78 79
79 args = parser.parse_args() 80 args = parser.parse_args()
80 81
81 # Handle options from conf and override with ini 82 # Handle options from conf and override with ini
82 def opthelper(args, conf, optname): 83 def opthelper(args, conf, optname):
388 389
389 if __name__ == "__main__": 390 if __name__ == "__main__":
390 names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)'] 391 names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)']
391 if args.munin != None: 392 if args.munin != None:
392 # Handle the wrapper passing us its $0 as our $1 393 # Handle the wrapper passing us its $0 as our $1
393 tmp = args.munin.split('_') 394 args.munin = args.munin.split('_')[-1]
394 if len(tmp) > 1:
395 args.munin = tmp[-1]
396 if args.munin not in ['signal', 'sync']: 395 if args.munin not in ['signal', 'sync']:
397 print "Unknown data type ", args.munin 396 print "Unknown data type ", args.munin
398 sys.exit(1) 397 sys.exit(1)
399 if len(args) > 0: 398 if len(args.rest) > 0:
400 if args[0] == 'config': 399 if args.rest[0] == 'config':
401 if args.munin == 'signal': 400 if args.munin == 'signal':
402 print '''graph_category adsl 401 print '''graph_category adsl
403 graph_title DSL Signal Quality 402 graph_title DSL Signal Quality
404 graph_args --base 1000 -l 0 403 graph_args --base 1000 -l 0
405 graph_vlabel dB''' 404 graph_vlabel dB'''