def _findBrickName(volInfo, brickPath): hostUuid = glustercli.hostUUIDGet() for volumeName, volumeInfo in volInfo.iteritems(): for brick in volumeInfo['bricksInfo']: if brick.get('hostUuid') == hostUuid \ and brick['name'].split(':')[1] == brickPath: return brick['name']
def getBrickStatus(volInfo): bricks = {} hostUuid = glustercli.hostUUIDGet() for volumeName, volumeInfo in volInfo.iteritems(): for brick in volumeInfo['bricksInfo']: if brick.get('hostUuid') != hostUuid: continue brickPath = brick['name'].split(':')[1] if volumeInfo['volumeStatus'] == glustercli.VolumeStatus.OFFLINE: status = utils.PluginStatusCode.CRITICAL msg = "CRITICAL: Brick %s is down" % brickPath else: status, msg = check_proc_util.getBrickStatus( volumeName, brick['name']) brickService = _brickService % brickPath bricks[brickService] = [status, msg] return bricks
def getBrickStatus(volInfo): bricks = {} hostUuid = glustercli.hostUUIDGet() for volumeName, volumeInfo in volInfo.iteritems(): for brick in volumeInfo['bricksInfo']: if brick.get('hostUuid') != hostUuid: continue brickPath = brick['name'].split(':')[1] if volumeInfo['volumeStatus'] == glustercli.VolumeStatus.OFFLINE: status = utils.PluginStatusCode.CRITICAL msg = "CRITICAL: Brick %s is down" % brickPath else: status, msg = check_proc_util.getBrickStatus(volumeName, brick['name']) brickService = _brickService % brickPath bricks[brickService] = [status, msg] return bricks
def getShdStatus(volInfo): status, msg, error = utils.execCmd(_checkShdCmd) if status == utils.PluginStatusCode.OK: return status, "Gluster Self Heal Daemon is running" hostUuid = glustercli.hostUUIDGet() for volumeName, volumeInfo in volInfo.iteritems(): if volumeInfo['volumeStatus'] == glustercli.VolumeStatus.OFFLINE: continue 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 return status, msg