summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-05-26 14:14:26 +0530
committerSahina Bose <sabose@redhat.com>2014-05-26 02:37:48 -0700
commit01d82e0403c765b8593c6b03b334ddde3162deb3 (patch)
tree7defd14a99fd3c388b6465fda818950862d82b81
parent553fd98e7ae1c6a0c01afeabcdcdd9080c5ac64c (diff)
plugins: Fixed repeated warn/crit words in disk util plugin
The disk utilization plugin output had repetition of words - Warn/Crit. Fixed this Change-Id: Idf5d657fd373189a1eb40c1f0d1b45ba4dd49e7b Bug-Url: https://bugzilla.redhat.com/1084421 Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7869
-rwxr-xr-xplugins/check_disk_and_inode.py43
1 files changed, 22 insertions, 21 deletions
diff --git a/plugins/check_disk_and_inode.py b/plugins/check_disk_and_inode.py
index 7574515..331edf1 100755
--- a/plugins/check_disk_and_inode.py
+++ b/plugins/check_disk_and_inode.py
@@ -116,6 +116,7 @@ def showDiskUsage(warn, crit, mountPaths, toListInode, usage=False,
diskList = []
mounts = []
level = -1
+ msg = ""
for path in mountPaths:
disk = getDisk(path,
@@ -168,33 +169,36 @@ def showDiskUsage(warn, crit, mountPaths, toListInode, usage=False,
if disk['usePcent'] >= crit or inode['usePcent'] >= crit:
if disk['usePcent'] >= crit:
critList.append(
- "crit:disk:%s;%s;%s%%" % (disk['fs'],
- disk['path'],
- disk['usePcent']))
+ "disk:%s;%s;%s%%" % (disk['fs'],
+ disk['path'],
+ disk['usePcent']))
else:
- critList.append("crit:inode:%s;%s;%s%%" % (inode['fs'],
- inode['path'],
- inode['usePcent']))
+ critList.append("inode:%s;%s;%s%%" % (inode['fs'],
+ inode['path'],
+ inode['usePcent']))
if not level > utils.PluginStatusCode.WARNING:
level = utils.PluginStatusCode.CRITICAL
elif (disk['usePcent'] >= warn and disk['usePcent'] < crit) or (
inode['usePcent'] >= warn and inode['usePcent'] < crit):
if disk['usePcent'] >= warn:
- warnList.append("warn:disk:%s;%s;%s%%" % (disk['fs'],
- disk['path'],
- disk['usePcent']))
+ warnList.append("disk:%s;%s;%s%%" % (disk['fs'],
+ disk['path'],
+ disk['usePcent']))
else:
- warnList.append("warn:inode:%s;%s;%s%%" % (inode['fs'],
- inode['path'],
- inode['usePcent']))
+ warnList.append("inode:%s;%s;%s%%" % (inode['fs'],
+ inode['path'],
+ inode['usePcent']))
if not level > utils.PluginStatusCode.OK:
level = utils.PluginStatusCode.WARNING
else:
diskList.append("%s=%s" % (disk['fs'], disk['path']))
- msg = " ".join(critList + warnList)
- if not msg:
- msg += " disks:mounts:(" + ",".join(diskList) + ")"
+ if len(critList) > 0:
+ msg += "CRITICAL: " + ",".join(critList) + " "
+ if len(warnList) > 0:
+ msg += "WARNING: " + ",".join(warnList) + " "
+ if len(diskList) > 0:
+ msg += "OK: disks:mounts:(" + ",".join(diskList) + ")"
return level, msg, diskPerf
@@ -219,19 +223,16 @@ if __name__ == '__main__':
options.ignore)
if utils.PluginStatusCode.CRITICAL == level:
- sys.stdout.write("%s : %s | %s\n" % (
- utils.PluginStatus.CRITICAL,
+ sys.stdout.write("%s | %s\n" % (
msg,
" ".join(diskPerf)))
sys.exit(utils.PluginStatusCode.CRITICAL)
elif utils.PluginStatusCode.WARNING == level:
- sys.stdout.write("%s : %s | %s\n" % (
- utils.PluginStatus.WARNING,
+ sys.stdout.write("%s | %s\n" % (
msg,
" ".join(diskPerf)))
sys.exit(utils.PluginStatusCode.WARNING)
else:
- sys.stdout.write("%s : %s | %s\n" % (
- utils.PluginStatus.OK,
+ sys.stdout.write("%s | %s\n" % (
msg,
" ".join(diskPerf)))