From fa6dc16dc4fc594caa6cc61f3d00ce7da3d22a5d Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 11 Feb 2011 13:41:35 +0100 Subject: [PATCH] monitoringplugin: Don't output warn/crit as 1.23e+45... Signed-off-by: Sven Velt --- monitoringplugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitoringplugin.py b/monitoringplugin.py index 899533f..8e55b88 100644 --- a/monitoringplugin.py +++ b/monitoringplugin.py @@ -1,3 +1,5 @@ +# -*- encoding: utf-8 -*- + __version__ = '0.0.100802' __all__ = ['MonitoringPlugin', 'SNMPMonitoringPlugin'] @@ -288,10 +290,10 @@ class MonitoringPlugin(object): range = range[1:] parts = range.split(':') - newrange += str(self.human_to_number(parts[0], total)) + newrange += ('%f' % self.human_to_number(parts[0], total)).rstrip('0').rstrip('.') if len(parts) > 1: - newrange += ':' + str(self.human_to_number(parts[1], total)) + newrange += ':' + ('%f' % self.human_to_number(parts[1], total)).rstrip('0').rstrip('.') if range != newrange: self.verbose(3, 'Changed range/thresold from "' + range + '" to "' + newrange + '"')