From 619ce45d7304226f06e2c15528f08eed1543fcce Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Tue, 25 Jan 2011 12:43:52 +0100 Subject: [PATCH] Refactor return code search, new function Signed-off-by: Sven Velt --- monitoringplugin.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/monitoringplugin.py b/monitoringplugin.py index ef29eb6..dcec5d7 100644 --- a/monitoringplugin.py +++ b/monitoringplugin.py @@ -306,11 +306,17 @@ class MonitoringPlugin(object): print 'V' + str(level) + ': ' + output - def exit(self): - for returncode in self.returncode_priority: - if returncode in self.__returncode: + def max_returncode(self, returncodes): + for rc in self.returncode_priority: + if rc in returncodes: break + return rc + + + def exit(self): + returncode = self.max_returncode(self.__returncode) + self.back2nagios(returncode, statusline=self.__output, multiline=self.__multilineoutput, performancedata=self.__performancedata)