diff 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
line wrap: on
line diff
--- a/adslstats.py	Fri Sep 27 14:44:56 2019 +0930
+++ b/adslstats.py	Fri Sep 27 14:45:09 2019 +0930
@@ -75,6 +75,7 @@
                     help='Base directory for RRD & PNGs')
 parser.add_argument('-c', '--cookiejar', action='store',
                     help='Location of cookiejar')
+parser.add_argument('rest', nargs = '*')
 
 args = parser.parse_args()
 
@@ -390,14 +391,12 @@
     names = ['Noise Margin (up)', 'Noise Margin (down)', 'Attenuation (up)', 'Attenuation (down)']
     if args.munin != None:
         # Handle the wrapper passing us its $0 as our $1
-        tmp = args.munin.split('_')
-        if len(tmp) > 1:
-            args.munin = tmp[-1]
+        args.munin = args.munin.split('_')[-1]
         if args.munin not in ['signal', 'sync']:
             print "Unknown data type ", args.munin
             sys.exit(1)
-        if len(args) > 0:
-            if args[0] == 'config':
+        if len(args.rest) > 0:
+            if args.rest[0] == 'config':
                 if args.munin == 'signal':
                     print '''graph_category adsl
 graph_title DSL Signal Quality