コード例 #1
0
ファイル: nodes_eru.py プロジェクト: mouxiaoyi/redis-ctl
def nodes_manage_page_eru_nodes(request, page):
    node_details = file_ipc.read_details()['nodes']
    nodes = []
    for n in models.node.list_eru_nodes(page * 20, 20):
        n.detail = node_details.get('%s:%d' % (n.host, n.port))
        nodes.append(n)
    return request.render('node/manage_eru_nodes.html', page=page, nodes=nodes)
コード例 #2
0
def cluster_panel(request, cluster_id):
    c = models.cluster.get_by_id(cluster_id)
    if c is None:
        return base.not_found()
    return request.render('cluster/panel.html',
                          cluster=c,
                          node_details=file_ipc.read_details()['nodes'])
コード例 #3
0
ファイル: nodes.py プロジェクト: beenkevin/redis-ctl
def node_panel(request, host, port):
    node = models.node.get_by_host_port(host, port)
    if node is None:
        return base.not_found()
    detail = {}
    try:
        detail = file_ipc.read_details()['nodes']['%s:%d' %
                                                  (node.host, node.port)]
    except (IOError, ValueError, KeyError):
        pass
    return request.render('node/panel.html', node=node, detail=detail)
コード例 #4
0
ファイル: nodes.py プロジェクト: sdgdsffdsfff/redis-ctl
def node_panel(request, host, port):
    node = models.node.get_by_host_port(host, port)
    if node is None:
        return base.not_found()
    detail = {}
    try:
        detail = file_ipc.read_details()['nodes'][
            '%s:%d' % (node.host, node.port)]
    except (IOError, ValueError, KeyError):
        pass
    return request.render('node/panel.html', node=node, detail=detail)
コード例 #5
0
ファイル: utils.py プロジェクト: mouxiaoyi/redis-ctl
def masters_detail(host, port):
    node_details = file_ipc.read_details()['nodes']
    result = []
    masters, myself = redistrib.command.list_masters(host, port)
    for n in masters:
        r = {'host': n.host, 'port': n.port}
        try:
            r['slots_count'] = len(node_details[
                '%s:%d' % (n.host, n.port)]['slots'])
        except KeyError:
            pass
        result.append(r)
    return result, myself
コード例 #6
0
ファイル: nodes.py プロジェクト: BarneyWang/redis-ctl
def node_panel(request, host, port):
    node = models.node.get_by_host_port(host, port)
    if node is None:
        return base.not_found()
    detail = {}
    try:
        detail = file_ipc.read_details()['nodes'][
            '%s:%d' % (node.host, node.port)]
    except (IOError, ValueError, KeyError):
        pass
    return request.render(
        'node/panel.html', node=node, detail=detail,
        max_mem_limit=NODE_MAX_MEM, stats_enabled=stats.client is not None)
コード例 #7
0
def node_panel(request, host, port):
    node = models.node.get_by_host_port(host, port)
    if node is None:
        return base.not_found()
    detail = {}
    try:
        detail = file_ipc.read_details()['nodes']['%s:%d' %
                                                  (node.host, node.port)]
    except (IOError, ValueError, KeyError):
        pass
    return request.render('node/panel.html',
                          node=node,
                          detail=detail,
                          max_mem_limit=config.NODE_MAX_MEM,
                          stats_enabled=stats.client is not None)
コード例 #8
0
def cluster_panel(request, cluster_id):
    c = models.cluster.get_by_id(cluster_id)
    if c is None or len(c.nodes) == 0:
        return base.not_found()
    all_details = file_ipc.read_details()
    node_details = all_details['nodes']
    nodes = []
    for n in c.nodes:
        detail = node_details.get('%s:%d' % (n.host, n.port))
        if detail is None:
            nodes.append({'host': n.host, 'port': n.port, 'stat': False})
        else:
            nodes.append(detail)

    proxy_details = all_details['proxies']
    for p in c.proxies:
        p.details = proxy_details.get('%s:%d' % (p.host, p.port), {})
    return request.render('cluster/panel.html', cluster=c, nodes=nodes,
                          eru_client=eru_utils.eru_client, plan_max_slaves=3,
                          stats_enabled=stats.client is not None)
コード例 #9
0
ファイル: index.py プロジェクト: BarneyWang/redis-ctl
def index(request):
    nodes = nm.list_all_nodes()
    clusters = cl.list_all()

    poll_result = file_ipc.read_details()
    node_details = poll_result['nodes']
    proxy_details = poll_result['proxies']

    proxies = []
    for c in clusters:
        for p in c.proxies:
            p.detail = proxy_details.get('%s:%d' % (p.host, p.port), {})
            p.stat = p.detail.get('stat', True)
        proxies.extend(c.proxies)

    for n in nodes:
        detail = node_details.get('%s:%d' % (n.host, n.port), {})
        n.node_id = detail.get('node_id')
        n.detail = detail
        n.stat = detail.get('stat', True)
    return request.render(
        'index.html', nodes=nodes, clusters=clusters,
        stats_enabled=stats.client is not None)
コード例 #10
0
def index(request):
    nodes = nm.list_all_nodes()
    clusters = cl.list_all()

    poll_result = file_ipc.read_details()
    node_details = poll_result['nodes']
    proxy_details = poll_result['proxies']

    proxies = []
    for c in clusters:
        for p in c.proxies:
            p.detail = proxy_details.get('%s:%d' % (p.host, p.port), {})
            p.stat = p.detail.get('stat', True)
        proxies.extend(c.proxies)

    for n in nodes:
        detail = node_details.get('%s:%d' % (n.host, n.port), {})
        n.node_id = detail.get('node_id')
        n.detail = detail
        n.stat = detail.get('stat', True)
    return request.render('index.html',
                          nodes=nodes,
                          clusters=clusters,
                          stats_enabled=stats.client is not None)
コード例 #11
0
 def polling_result(self):
     return file_ipc.read_details()
コード例 #12
0
ファイル: cluster.py プロジェクト: sdgdsffdsfff/redis-ctl
def cluster_panel(request, cluster_id):
    c = models.cluster.get_by_id(cluster_id)
    if c is None:
        return base.not_found()
    return request.render('cluster/panel.html', cluster=c,
                          node_details=file_ipc.read_details()['nodes'])