diff options
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/check_proc_util.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/check_proc_util.py b/plugins/check_proc_util.py index 28c19ef..54c67a0 100755 --- a/plugins/check_proc_util.py +++ b/plugins/check_proc_util.py @@ -34,7 +34,8 @@ _chkConfig = utils.CommandPath('chkconfig', _chkService = utils.CommandPath('service', '/sbin/service', 'usr/sbin/service') -_glusterVolPath = "/var/lib/glusterd/vols" +_glusterVolRunFmt = ["/var/run/gluster/vols/%s/", + "/var/lib/glusterd/vols/%s/run/"] _checkGlusterService = [_chkService.cmd, "glusterd", "status"] _checkNfsCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", "nfs"] _checkShdCmd = [_checkProc.cmd, "-c", "1:", "-C", "glusterfs", "-a", @@ -69,8 +70,20 @@ def getBrickStatus(volumeName, brickName): brickPath = brickName.split(':')[1] pidFile = brickName.replace(":/", "-").replace("/", "-") + ".pid" try: - with open("%s/%s/run/%s" % ( - _glusterVolPath, volumeName, pidFile)) as f: + brickPidFile = None + for fmt in _glusterVolRunFmt: + brickPidFile = (fmt % (volumeName)) + pidFile + if os.path.exists(brickPidFile): + break + else: + brickPidFile = None + + if not brickPidFile: + status = utils.PluginStatusCode.CRITICAL + msg = "Could not find pid for brick %s" % (brickPath) + return status, msg + + with open(brickPidFile) as f: try: if _pidExists(int(f.read().strip())): status = utils.PluginStatusCode.OK |