diff options
author | Timothy Asir <tjeyasin@redhat.com> | 2014-05-30 12:45:42 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2014-06-04 03:34:04 -0700 |
commit | 88e20366bc84f7e6f68a21eee09c4135a7efa1eb (patch) | |
tree | ae7e99b04c52b8563a57ffb5d9ac73a9894edf5a | |
parent | 19a944e388d71b8bcae5b3da004df0d9fa846668 (diff) |
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 <tjeyasin@redhat.com>
Reviewed-on: http://review.gluster.org/7930
Tested-by: Timothy Asir <tim.gluster@gmail.com>
Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com>
Reviewed-by: Kanagaraj M <kmayilsa@redhat.com>
Reviewed-by: Sahina Bose <sabose@redhat.com>
-rwxr-xr-x | plugins/check_disk_and_inode.py | 16 |
1 files changed, 14 insertions, 2 deletions
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']: |