changeset 30:08cddcdb0db3

fix Munin plugin
author Daniel O'Connor <darius@dons.net.au>
date Fri, 27 Sep 2019 14:45:09 +0930
parents e73e4677f873
children 39bf6dec0753
files adslstats.py muninplugin
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
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
--- a/muninplugin	Fri Sep 27 14:44:56 2019 +0930
+++ b/muninplugin	Fri Sep 27 14:45:09 2019 +0930
@@ -7,5 +7,7 @@
 # Add entry to /usr/local/etc/munin/plugin-conf.d/plugins.conf
 # [adslstats_*]
 # user darius
+# env.HOME /home/darius
 
 /usr/local/bin/python2 /home/darius/projects/adslstats/adslstats.py -m $0 $1
+