From 03e3044bf148048d25367de4a7b5fda46956a80b Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Thu, 8 May 2014 16:53:26 +0530 Subject: gluster-nagios-addons : modified the plugin output for UNKNOWN Modified the plugin output when there is failure from ligfapi and not able to retrieve the data Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1095611 Change-Id: I3b48772b80882c67d4260c036090961a97347390 Signed-off-by: Nishanth Thomas Reviewed-on: http://review.gluster.org/7712 Reviewed-by: Sahina Bose Tested-by: Nishanth Thomas --- plugins/check_vol_utilization.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/check_vol_utilization.py b/plugins/check_vol_utilization.py index d0ab5c6..151a724 100755 --- a/plugins/check_vol_utilization.py +++ b/plugins/check_vol_utilization.py @@ -27,8 +27,9 @@ def showVolumeUtilization(vname, warnLevel, critLevel): buf = {} try: buf = capacity.statvfs(vname, "localhost") - except Exception as e: - sys.stdout.write(("Volume Utilization UNKNOWN: %s\n" % str(e))) + except Exception: + sys.stdout.write("UNKNOWN: Failed to get the " + "Volume Utilization Data\n") sys.exit(utils.PluginStatusCode.UNKNOWN) # print buf @@ -60,17 +61,17 @@ def showVolumeUtilization(vname, warnLevel, critLevel): if int(vol_utilization) > critLevel: sys.stdout.write( - ("Volume Utilization CRITICAL: Utilization:%s%%" + ("CRITICAL: Utilization:%s%%" "| %s\n" % (str(int(vol_utilization)), " ".join(perfLines)))) sys.exit(utils.PluginStatusCode.CRITICAL) elif int(vol_utilization) > warnLevel: sys.stdout.write( - ("Volume Utilization WARNING: Utilization:%s%%" + ("WARNING: Utilization:%s%%" "| %s\n" % (str(int(vol_utilization)), " ".join(perfLines)))) sys.exit(utils.PluginStatusCode.WARNING) else: sys.stdout.write( - ("Volume Utilization OK: Utilization:%s%%" + ("OK: Utilization:%s%%" "| %s\n" % (str(int(vol_utilization)), " ".join(perfLines)))) sys.exit(utils.PluginStatusCode.OK) -- cgit