diff options
author | Kanagaraj M <kmayilsa@redhat.com> | 2014-04-17 10:35:24 +0530 |
---|---|---|
committer | Bala.FA <barumuga@redhat.com> | 2014-04-29 10:14:33 +0530 |
commit | f29c69c222f88fffcd53d01c718eda607ddbe33a (patch) | |
tree | 0bb4dc3eada2ef3bcc40dcfd1fc3e7d8f4c4e980 /plugins/check_proc_status.py | |
parent | 96c09b042087e1a0bfbc56400120bdd21d0d346d (diff) |
check-proc: Fix issues in SHD and NFS
- Skipped OFFLINE volumes for checking nfs option
- Fixed a loop issue in SHD
Change-Id: I76a07ceb6724c6d723aec135021501518341fab7
Signed-off-by: Kanagaraj M <kmayilsa@redhat.com>
Diffstat (limited to 'plugins/check_proc_status.py')
-rwxr-xr-x | plugins/check_proc_status.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/check_proc_status.py b/plugins/check_proc_status.py index 20b7b32..47cf71e 100755 --- a/plugins/check_proc_status.py +++ b/plugins/check_proc_status.py @@ -89,8 +89,10 @@ def sendNfsStatus(hostName, volInfo): # if nfs is not running and any of the volume uses nfs # then its required to alert the user - for k, v in volInfo.iteritems(): - nfsStatus = v.get('options', {}).get('nfs.disable', 'off') + for volume, volumeInfo in volInfo.iteritems(): + if volumeInfo['volumeStatus'] == glustercli.VolumeStatus.OFFLINE: + continue + nfsStatus = volumeInfo.get('options', {}).get('nfs.disable', 'off') if nfsStatus == 'off': msg = "CRITICAL: Process glusterfs-nfs is not running" status = utils.PluginStatusCode.CRITICAL @@ -153,18 +155,24 @@ def sendShdStatus(hostName, volInfo): for volumeName, volumeInfo in volInfo.iteritems(): if volumeInfo['volumeStatus'] == glustercli.VolumeStatus.OFFLINE: continue - for brick in volumeInfo['bricksInfo']: - if brick['hostUuid'] == hostUuid and \ - int(volumeInfo['replicaCount']) > 1: - status = utils.PluginStatusCode.CRITICAL - msg = "CRITICAL: Gluster Self Heal Daemon not running" - break + if hasBricks(hostUuid, volumeInfo['bricksInfo']) and \ + int(volumeInfo['replicaCount']) > 1: + status = utils.PluginStatusCode.CRITICAL + msg = "CRITICAL: Gluster Self Heal Daemon not running" + break else: msg = "OK: Process Gluster Self Heal Daemon" status = utils.PluginStatusCode.OK nscautils.send_to_nsca(hostName, _shdService, status, msg) +def hasBricks(hostUuid, bricks): + for brick in bricks: + if brick['hostUuid'] == hostUuid: + return True + return False + + if __name__ == '__main__': hostName = nscautils.getCurrentHostNameInNagiosServer() if not hostName: |