diff --git a/plugins/monit/monit_parser b/plugins/monit/monit_parser index f89bd4db..599f57a8 100755 --- a/plugins/monit/monit_parser +++ b/plugins/monit/monit_parser @@ -17,7 +17,7 @@ def sanitize(s): out = str() for char in s: if char.lower() in OK_CHARS: - out += char + out += char return out procs = dict() @@ -33,20 +33,20 @@ for line in output: m = re.match("^Process '(.*)'.*$", line) if m: cur_proc = sanitize(m.group(1)) - try: - procs[cur_proc] - except KeyError: - procs[cur_proc] = dict() - continue + try: + procs[cur_proc] + except KeyError: + procs[cur_proc] = dict() + continue m = re.match(" memory kilobytes total\s+([0-9]+).*$", line) if m: procs[cur_proc]["total_memory"] = m.group(1) - continue + continue m = re.match(" cpu percent total\s+([.0-9]+)%.*$", line) if m: procs[cur_proc]["total_cpu"] = m.group(1) - continue - + continue + if len(sys.argv) > 1 and sys.argv[1] == 'config': print 'graph_title Per process stats from Monit' print 'graph_vlabel numbers' @@ -55,7 +55,7 @@ if len(sys.argv) > 1 and sys.argv[1] == 'config': for stat in procs[process]: print "monit_%s_%s.label %s.%s" % (process, stat, process, stat) if stat == 'total_memory': - print "monit_%s_%s.warning 1:" % (process, stat) + print "monit_%s_%s.warning 1:" % (process, stat) sys.exit(0) for process in procs: