Пример #1
0
def run(url="", user="", passwrd="", nodes=[], slow_queries=True, num_samples = 60, result_set=60):
    '''Entry point for getting the metrics for the query nodes'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if num_samples != 60:
        result_set = num_samples
    if len(nodes) == 0:
        if len(cluster_values['serviceNodes']['n1ql']) > 0:
            # get the metrics from the query service for each of the n1ql nodes
            query_metrics = _get_metrics(
                user,
                passwrd,
                cluster_values['serviceNodes']['n1ql'], cluster_values['clusterName'],
                slow_queries,
                result_set)
            metrics = query_metrics['metrics']
    else:
        # get the metrics from the query service for each of the n1ql nodes
        query_metrics = _get_metrics(
            user,
            passwrd,
            nodes, cluster_values['clusterName'],
            slow_queries,
            result_set)
        metrics = query_metrics['metrics']
    return metrics
Пример #2
0
def run(url="",
        user="",
        passwrd="",
        buckets=[],
        nodes=[],
        num_samples=60,
        result_set=60):
    '''Entry point for getting the metrics for the kv nodes and buckets'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if num_samples != 60:
        result_set = num_samples
    if len(nodes) == 0:
        if len(cluster_values['serviceNodes']['kv']) > 0:
            bucket_metrics = _get_metrics(user, passwrd,
                                          cluster_values['serviceNodes']['kv'],
                                          cluster_values['clusterName'],
                                          buckets, result_set)
            metrics = bucket_metrics['metrics']
    else:
        bucket_metrics = _get_metrics(user, passwrd, nodes,
                                      cluster_values['clusterName'], buckets,
                                      result_set)
        metrics = bucket_metrics['metrics']
    return metrics
def run(url="",
        user="",
        passwrd="",
        buckets=[],
        nodes=[],
        key="",
        mctiming_path="",
        ssh_un="",
        ssh_host="",
        result_set=60):
    '''Entry point for getting the mctimings'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    node_list = []
    if len(buckets) == 0:
        buckets = get_buckets(url, user, passwrd)
    for _node in cluster_values['serviceNodes']['kv']:
        node_list.append(_node.split(":")[0])
    cluster = cluster_values['clusterName']
    if len(nodes) == 0:
        if len(cluster_values['serviceNodes']['kv']) > 0:
            mctiming_metrics = _get_metrics(user, passwrd,
                                            cluster_values['clusterName'],
                                            buckets, node_list, key,
                                            mctiming_path, ssh_un, ssh_host)
            metrics = filter(None, mctiming_metrics['metrics'])
    else:
        mctiming_metrics = _get_metrics(user, passwrd,
                                        cluster_values['clusterName'], buckets,
                                        nodes, key, mctiming_path, ssh_un,
                                        ssh_host)
        metrics = filter(None, mctiming_metrics['metrics'])
    return metrics
def run(url="", user="", passwrd="", nodes=[]):
    '''Entry point for getting the metrics for the analytics nodes'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if len(nodes) == 0:
        if len(cluster_values['nodeList']) > 0:
            __metrics = _get_metrics(user, passwrd, cluster_values['nodeList'],
                                     cluster_values['clusterName'])
            metrics = __metrics['metrics']
    else:
        __metrics = _get_metrics(user, passwrd, nodes,
                                 cluster_values['clusterName'])
        metrics = __metrics['metrics']
    return metrics
Пример #5
0
def run(url="",
        user="",
        passwrd="",
        nodes=[],
        buckets=[],
        num_samples=60,
        result_set=60):
    '''Entry point for getting the metrics for xdcr'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if num_samples != 60:
        result_set = num_samples
    try:
        if len(nodes) == 0:
            if len(buckets) == 0:
                if len(cluster_values['serviceNodes']['kv']) > 0:
                    bucket_metrics = cb_bucket._get_buckets(
                        cluster_values['serviceNodes']['kv'][0], user, passwrd)
            else:
                bucket_metrics = buckets
            xdcr_metrics = _get_metrics(user, passwrd,
                                        cluster_values['serviceNodes']['kv'],
                                        bucket_metrics,
                                        cluster_values['clusterName'],
                                        result_set)
            metrics = xdcr_metrics['metrics']

        else:
            if len(buckets) == 0:
                bucket_metrics = cb_bucket._get_metrics(
                    user, passwrd, nodes, cluster_values['clusterName'],
                    result_set)
            else:
                bucket_metrics = {"buckets": buckets}

            xdcr_metrics = _get_metrics(user, passwrd, nodes,
                                        bucket_metrics['buckets'],
                                        cluster_values['clusterName'],
                                        result_set)

            metrics = xdcr_metrics['metrics']
    except Exception as e:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        print("Error getting xdcr started {}: {} {}, {}".format(
            nodes, str(e.args), exc_value, exc_traceback.tb_lineno))
    return metrics
Пример #6
0
def run(url="",
        user="",
        passwrd="",
        index=[],
        buckets=[],
        nodes=[],
        num_samples=60,
        result_set=60):
    '''Entry point for getting the metrics for the index nodes'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if num_samples != 60:
        result_set = num_samples
    if len(buckets) == 0:
        buckets = cb_bucket._get_index_buckets(url, user, passwrd)

    if len(nodes) == 0:
        if len(cluster_values['serviceNodes']['index']) > 0 and len(
                buckets) > 0:
            # get the index replica stats
            index_replicas = _get_index_replica_counts(
                cluster_values['serviceNodes']['index'][0], user, passwrd,
                cluster_values['clusterName'])
            metrics = metrics + index_replicas['metrics']

            index_metrics = _get_metrics(
                user, passwrd, cluster_values['serviceNodes']['index'],
                buckets, cluster_values['clusterName'], result_set)

            metrics = metrics + index_metrics['metrics']
    else:

        if len(buckets) > 0:
            # get the index replica stats
            index_replicas = _get_index_replica_counts(
                nodes[0], user, passwrd, cluster_values['clusterName'])
            metrics = metrics + index_replicas['metrics']

            index_metrics = _get_metrics(user, passwrd, nodes, buckets,
                                         cluster_values['clusterName'],
                                         result_set)

            metrics = metrics + index_metrics['metrics']

    return metrics
def run(url="", user="", passwrd="", nodes=[], num_samples=60, result_set=60):
    '''Entry point for getting the metrics for the system from the nodes'''
    url = check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    if num_samples != 60:
        result_set = num_samples
    if len(nodes) == 0:
        if len(cluster_values['nodeList']) > 0:
            # get node metrics
            node_metrics = cb_nodes._get_metrics(user, passwrd,
                                                 cluster_values['nodeList'],
                                                 cluster_values['clusterName'],
                                                 result_set)
            metrics = metrics + node_metrics['metrics']
            # get system metrics
            cluster_metrics = _get_metrics(user, passwrd,
                                           cluster_values['nodeList'],
                                           cluster_values['clusterName'],
                                           result_set)
            metrics = metrics + cluster_metrics['metrics']
            # get disk metrics
            disk_metrics = _get_disk_metrics(user, passwrd,
                                             cluster_values['nodeList'],
                                             cluster_values['clusterName'])
            metrics = metrics + disk_metrics['metrics']
    else:
        # get node metrics
        node_metrics = cb_nodes._get_metrics(user, passwrd, nodes,
                                             cluster_values['clusterName'],
                                             result_set)
        metrics = metrics + node_metrics['metrics']
        # get system metrics
        cluster_metrics = _get_metrics(user, passwrd, nodes,
                                       cluster_values['clusterName'],
                                       result_set)
        metrics = metrics + cluster_metrics['metrics']
        # get disk metrics
        disk_metrics = _get_disk_metrics(user, passwrd,
                                         cluster_values['nodeList'],
                                         cluster_values['clusterName'])
        metrics = metrics + disk_metrics['metrics']
    return metrics