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 <sven@velt.de>
This commit is contained in:
Sven Velt 2011-02-11 13:42:36 +01:00
parent fa6dc16dc4
commit 779250f8eb

View file

@ -272,7 +272,10 @@ class MonitoringPlugin(object):
if total: if total:
return float(value[:-1])/100.0 * float(total) return float(value[:-1])/100.0 * float(total)
else: 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: elif value[-1].lower() in self.powers_si_lower:
return 1000.0 ** self.powers_si_lower.index(value[-1].lower()) * float(value[:-1]) return 1000.0 ** self.powers_si_lower.index(value[-1].lower()) * float(value[:-1])
elif value[-2:].lower() in self.powers_binary_lower: elif value[-2:].lower() in self.powers_binary_lower: