From 88e20366bc84f7e6f68a21eee09c4135a7efa1eb Mon Sep 17 00:00:00 2001 From: Timothy Asir Date: Fri, 30 May 2014 12:45:42 +0530 Subject: Send brick path not found error when a brick path not found. Change-Id: Ib8d40b862d0102d352af472c7862e79ac0e085d8 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1083849 Signed-off-by: Timothy Asir Reviewed-on: http://review.gluster.org/7930 Tested-by: Timothy Asir Reviewed-by: Shubhendu Tripathi Reviewed-by: Kanagaraj M Reviewed-by: Sahina Bose --- plugins/check_disk_and_inode.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/check_disk_and_inode.py b/plugins/check_disk_and_inode.py index b48c19c..78aa7a2 100755 --- a/plugins/check_disk_and_inode.py +++ b/plugins/check_disk_and_inode.py @@ -38,8 +38,17 @@ def getVal(val): def getUsageAndFree(command, lvm): disk = {'path': None, 'usePercent': None, 'avail': None, - 'used': None, 'size': None, 'fs': None} - status = commands.getstatusoutput(command)[1].split() + 'used': None, 'size': None, 'fs': None, 'status':None, + 'retCode':0} + status = commands.getstatusoutput(command) + if status[0] != 0: + disk['retCode'] = status[0] + if status[0] == 256: + disk['status'] = "Brick path not found!" + else: + disk['status'] = status[1] + return disk + status = status[1].split() disk['path'] = status[-1] disk['avail'] = getVal(status[-3]) disk['used'] = getVal(status[-4]) @@ -126,6 +135,9 @@ def showDiskUsage(warn, crit, mountPaths, toListInode, usage=False, inode = getInode(path, isLvm) + if disk['retCode'] != 0 or inode['retCode'] != 0: + return utils.PluginStatusCode.CRITICAL, disk['status'], "" + if disk['path'] in mounts: continue if not disk['used'] or not inode['used']: -- cgit