Пример #1
0
def get_xdcr(url="", user="", passwrd="", nodes=[], buckets=[]):
    '''Entry point for getting the metrics for xdcr'''
    url = cb_utilities.check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])

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

        xdcr_metrics = cb_xdcr._get_xdcr_metrics(
            user, passwrd, cluster_values['serviceNodes']['kv'],
            bucket_metrics['buckets'], cluster_values['clusterName'])

        metrics = xdcr_metrics['metrics']

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

        xdcr_metrics = cb_xdcr._get_xdcr_metrics(user, passwrd, nodes,
                                                 bucket_metrics['buckets'],
                                                 cluster_values['clusterName'])

        metrics = xdcr_metrics['metrics']

    return metrics
Пример #2
0
def get_indexes(url="", user="", passwrd="", index=[], buckets=[], nodes=[]):
    '''Entry point for getting the metrics for the index nodes'''
    url = cb_utilities.check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    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:
            index_metrics = cb_index._get_index_metrics(
                user, passwrd, cluster_values['serviceNodes']['index'],
                buckets, cluster_values['clusterName'])

            metrics = index_metrics['metrics']
    else:

        if len(buckets) > 0:
            index_metrics = cb_index._get_index_metrics(
                user, passwrd, nodes, buckets, cluster_values['clusterName'])

            metrics = index_metrics['metrics']

    return metrics
Пример #3
0
def get_system(url="", user="", passwrd="", nodes=[]):
    '''Entry point for getting the metrics for the system from the nodes'''
    url = cb_utilities.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:
            # get node metrics
            node_metrics = cb_nodes._get_node_metrics(
                user, passwrd, cluster_values['nodeList'],
                cluster_values['clusterName'])
            metrics = metrics + node_metrics['metrics']
            # get system metrics
            cluster_metrics = cb_system._get_system_metrics(
                user, passwrd, cluster_values['nodeList'],
                cluster_values['clusterName'])
            metrics = metrics + cluster_metrics['metrics']
    else:
        # get node metrics
        node_metrics = cb_nodes._get_node_metrics(
            user, passwrd, nodes, cluster_values['clusterName'])
        metrics = metrics + node_metrics['metrics']
        # get system metrics
        cluster_metrics = cb_system._get_system_metrics(
            user, passwrd, nodes, cluster_values['clusterName'])
        metrics = cluster_metrics['metrics']
    return metrics
Пример #4
0
def get_query(url="", user="", passwrd="", nodes=[], slow_queries=True):
    '''Entry point for getting the metrics for the query nodes'''
    url = cb_utilities.check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])

    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 = cb_query._get_query_metrics(
                user, passwrd, cluster_values['serviceNodes']['n1ql'],
                cluster_values['clusterName'], slow_queries)
            metrics = query_metrics['metrics']
    else:
        # get the metrics from the query service for each of the n1ql nodes
        query_metrics = cb_query._get_query_metrics(
            user, passwrd, nodes, cluster_values['clusterName'], slow_queries)
        metrics = query_metrics['metrics']
    return metrics
Пример #5
0
def get_cbas(url="", user="", passwrd="", nodes=[]):
    '''Entry point for getting the metrics for the analytics nodes'''
    url = cb_utilities.check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])

    if len(nodes) == 0:

        if len(cluster_values['serviceNodes']['cbas']) > 0:
            cbas_metrics = cb_analytics._get_cbas_metrics(
                user, passwrd, cluster_values['serviceNodes']['cbas'],
                cluster_values['clusterName'])

            metrics = cbas_metrics['metrics']
    else:
        cbas_metrics = cb_analytics._get_cbas_metrics(
            user, passwrd, nodes, cluster_values['clusterName'])
        metrics = cbas_metrics['metrics']

    return metrics
Пример #6
0
def get_eventing(url="", user="", passwrd="", nodes=[]):
    '''Entry point for getting the metrics for the eventing nodes'''
    url = cb_utilities.check_cluster(url, user, passwrd)
    metrics = []
    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])

    if len(nodes) == 0:
        if len(cluster_values['serviceNodes']['eventing']) > 0:
            eventing_metrics = cb_eventing._get_eventing_metrics(
                user, passwrd, cluster_values['serviceNodes']['eventing'],
                cluster_values['clusterName'])

            metrics = eventing_metrics['metrics']
    else:
        eventing_metrics = cb_eventing._get_eventing_metrics(
            user, passwrd, nodes, cluster_values['clusterName'])

        metrics = eventing_metrics['metrics']

    return metrics
Пример #7
0
def get_metrics(url="", user="", passwrd=""):
    '''This is the entry point for this script. Gets each type of metric and
    combines them to present'''
    url = cb_utilities.check_cluster(url, user, passwrd)

    cluster_values = cb_cluster._get_cluster(url, user, passwrd, [])
    metrics = cluster_values['metrics']
    index_buckets = cb_bucket._get_index_buckets(url, user, passwrd)

    node_metrics = cb_nodes._get_node_metrics(user, passwrd,
                                              cluster_values['nodeList'],
                                              cluster_values['clusterName'])
    metrics = metrics + node_metrics['metrics']

    system_metrics = cb_system._get_system_metrics(
        user, passwrd, cluster_values['nodeList'],
        cluster_values['clusterName'])
    metrics = metrics + system_metrics['metrics']

    if len(cluster_values['serviceNodes']['kv']) > 0:
        bucket_metrics = cb_bucket._get_bucket_metrics(
            user, passwrd, cluster_values['serviceNodes']['kv'],
            cluster_values['clusterName'])
        metrics = metrics + bucket_metrics['metrics']

        xdcr_metrics = cb_xdcr._get_xdcr_metrics(
            user, passwrd, cluster_values['serviceNodes']['kv'],
            bucket_metrics['buckets'], cluster_values['clusterName'])
        metrics = metrics + xdcr_metrics['metrics']

    if len(cluster_values['serviceNodes']['index']) > 0 and index_buckets > 0:
        index_metrics = cb_index._get_index_metrics(
            user, passwrd, cluster_values['serviceNodes']['index'],
            index_buckets, cluster_values['clusterName'])
        metrics = metrics + index_metrics['metrics']

    if len(cluster_values['serviceNodes']['n1ql']) > 0:
        query_metrics = cb_query._get_query_metrics(
            user, passwrd, cluster_values['serviceNodes']['n1ql'],
            cluster_values['clusterName'])
        metrics = metrics + query_metrics['metrics']

    if len(cluster_values['serviceNodes']['eventing']) > 0:
        eventing_metrics = cb_eventing._get_eventing_metrics(
            user, passwrd, cluster_values['serviceNodes']['eventing'],
            cluster_values['clusterName'])
        metrics = metrics + eventing_metrics['metrics']

    if len(cluster_values['serviceNodes']['fts']) > 0:
        fts_metrics = cb_fts._get_fts_metrics(
            user, passwrd, cluster_values['serviceNodes']['fts'],
            bucket_metrics['buckets'], cluster_values['clusterName'])
        metrics = metrics + fts_metrics['metrics']

    if len(cluster_values['serviceNodes']['cbas']) > 0:
        cbas_metrics = cb_analytics._get_cbas_metrics(
            user, passwrd, cluster_values['serviceNodes']['cbas'],
            cluster_values['clusterName'])
        metrics = metrics + cbas_metrics['metrics']

    return (metrics)