mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
[monit_parser] fix whitespace issues
This commit is contained in:
parent
207f801148
commit
0f24fe00eb
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user