monitoringplugin: Shorter output for 1 check in brain
Signed-off-by: Sven Velt <sven@velt.de>
This commit is contained in:
parent
9b2009c2c8
commit
24ed140d4a
|
@ -234,28 +234,32 @@ class MonitoringPlugin(object):
|
||||||
|
|
||||||
|
|
||||||
def brain2output(self):
|
def brain2output(self):
|
||||||
out = [[], [], [], []]
|
if len(self.__brain_checks) == 1:
|
||||||
for check in self.__brain_checks:
|
check = self.__brain_checks[0]
|
||||||
tagtarget = self.tagtarget(check['tag'], check.get('target'))
|
self.add_output(check.get('output'))
|
||||||
returncode = check.get('returncode') or 0
|
|
||||||
self.add_returncode(returncode)
|
|
||||||
|
|
||||||
out[returncode].append(tagtarget)
|
|
||||||
#if returncode == 0:
|
|
||||||
# self.add_output(tagtarget)
|
|
||||||
#else:
|
|
||||||
# self.add_output(tagtarget + '(' + check.get('output') + ') ')
|
|
||||||
|
|
||||||
self.add_multilineoutput(self.RETURNSTRINGS[returncode] + ' ' + tagtarget + ' - ' + check.get('output'))
|
|
||||||
if check.get('multilineoutput'):
|
if check.get('multilineoutput'):
|
||||||
self.add_multilineoutput(check.get('multilineoutput'))
|
self.add_multilineoutput(check.get('multilineoutput'))
|
||||||
|
self.add_returncode(check.get('returncode') or 0)
|
||||||
|
|
||||||
statusline = []
|
else:
|
||||||
for retcode in self.returncode_priority:
|
out = [[], [], [], []]
|
||||||
if len(out[retcode]):
|
for check in self.__brain_checks:
|
||||||
statusline.append(str(len(out[retcode])) + ' ' + self.RETURNSTRINGS[retcode] + ': ' + ' '.join(out[retcode]))
|
tagtarget = self.tagtarget(check['tag'], check.get('target'))
|
||||||
statusline = ', '.join(statusline)
|
returncode = check.get('returncode') or 0
|
||||||
self.add_output(statusline)
|
self.add_returncode(returncode)
|
||||||
|
|
||||||
|
out[returncode].append(tagtarget)
|
||||||
|
|
||||||
|
self.add_multilineoutput(self.RETURNSTRINGS[returncode] + ' ' + tagtarget + ' - ' + check.get('output'))
|
||||||
|
if check.get('multilineoutput'):
|
||||||
|
self.add_multilineoutput(check.get('multilineoutput'))
|
||||||
|
|
||||||
|
statusline = []
|
||||||
|
for retcode in self.returncode_priority:
|
||||||
|
if len(out[retcode]):
|
||||||
|
statusline.append(str(len(out[retcode])) + ' ' + self.RETURNSTRINGS[retcode] + ': ' + ' '.join(out[retcode]))
|
||||||
|
statusline = ', '.join(statusline)
|
||||||
|
self.add_output(statusline)
|
||||||
|
|
||||||
for pd in self.__brain_perfdata:
|
for pd in self.__brain_perfdata:
|
||||||
self.format_add_performancedata(**pd)
|
self.format_add_performancedata(**pd)
|
||||||
|
|
Loading…
Reference in a new issue