From 779250f8eb2de8438db49d44e98d48bc6ce3f078 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 11 Feb 2011 13:42:36 +0100 Subject: [PATCH] monitoringplugin: Return 0.0 as warn/crit at dehumanizing when total=0 check_naf vol_snap needs this for working flawlessly Signed-off-by: Sven Velt --- monitoringplugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/monitoringplugin.py b/monitoringplugin.py index 8e55b88..c56fc5e 100644 --- a/monitoringplugin.py +++ b/monitoringplugin.py @@ -272,7 +272,10 @@ class MonitoringPlugin(object): if total: return float(value[:-1])/100.0 * float(total) else: - return float(value[:-1]) + if total in [0, 0.0]: + return 0.0 + else: + return float(value[:-1]) # FIXME: Good idea? elif value[-1].lower() in self.powers_si_lower: return 1000.0 ** self.powers_si_lower.index(value[-1].lower()) * float(value[:-1]) elif value[-2:].lower() in self.powers_binary_lower: