Beispiel #1
0
def show_regionserver(request, id):
  rs = dbutil.get_regionserver(id)
  cluster = rs.cluster

  read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(rs);
  params = {
    'chart_id': 'read_requests_on_rs',
    'chart_title': 'read requests on region',
    'request_dist': read_requests_dist_by_rs,
  }

  read_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'write_requests_on_rs',
    'chart_title': 'write requests on region',
    'request_dist': write_requests_dist_by_rs,
  }
  write_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(
    Context(params))

  group = str(rs)
  tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, 'readRequestsCountPerSec')]
  tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, 'writeRequestsCountPerSec')]

  params = {
    'cluster': cluster,
    'regionserver': rs,
    'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart,
    'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }
  return respond(request, 'monitor/hbase_regionserver.html', params)
Beispiel #2
0
def show_service(request, id):
    service = dbutil.get_service(id)
    clusters = dbutil.get_clusters_by_service(id)
    params = {
        'service': service,
        'clusters': clusters,
    }
    if service.name == 'hbase':

        tsdb_read_query = []
        tsdb_write_query = []
        for cluster in clusters:
            tsdb_read_query.append(
                metric_helper.make_metric_query(cluster.name, 'Cluster',
                                                'readRequestsCountPerSec'))
            tsdb_write_query.append(
                metric_helper.make_metric_query(cluster.name, 'Cluster',
                                                'writeRequestsCountPerSec'))

        params.update({
            'tsdb_read_query': tsdb_read_query,
            'tsdb_write_query': tsdb_write_query,
        })

        return respond(request, 'monitor/hbase_service.html', params)
    else:
        return respond(request, 'monitor/service.html', params)
Beispiel #3
0
def show_regionserver(request, id):
  rs = dbutil.get_regionserver(id)
  cluster = rs.cluster

  read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(rs);
  params = {
    'chart_id': 'read_requests_on_rs',
    'chart_title': 'read requests on region',
    'request_dist': read_requests_dist_by_rs,
  }

  read_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'write_requests_on_rs',
    'chart_title': 'write requests on region',
    'request_dist': write_requests_dist_by_rs,
  }
  write_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(
    Context(params))

  group = str(rs)
  tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, 'readRequestsCountPerSec')]
  tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, 'writeRequestsCountPerSec')]

  params = {
    'cluster': cluster,
    'regionserver': rs,
    'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart,
    'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }
  return respond(request, 'monitor/hbase_regionserver.html', params)
Beispiel #4
0
def show_cluster_basic_board(request, id):
    cluster = dbutil.get_cluster(id)
    if cluster.service.name != 'hbase':
        # return empty paget for unsupported service
        return HttpResponse('')

    basic_info = dbutil.get_hbase_basic_info(cluster)
    hdfs_cluster = dbutil.get_hdfs_cluster_by_name(cluster.name)

    group = 'Cluster'
    tsdb_read_query = [
        metric_helper.make_metric_query(cluster.name, group,
                                        'readRequestsCountPerSec')
    ]
    tsdb_write_query = [
        metric_helper.make_metric_query(cluster.name, group,
                                        'writeRequestsCountPerSec')
    ]

    params = {
        'cluster': cluster,
        'hdfs_cluster': hdfs_cluster,
        'basic_info': basic_info,
        'tsdb_read_query': tsdb_read_query,
        'tsdb_write_query': tsdb_write_query,
    }
    return respond(request, 'monitor/hbase_basic_board.html', params)
Beispiel #5
0
def show_cluster_table_board(request, id):
    cluster = dbutil.get_cluster(id)
    if cluster.service.name != 'hbase':
        # return empty paget for unsupported service
        return HttpResponse('')
    read_requests_dist_by_table, write_requests_dist_by_table = dbutil.get_requests_distribution_groupby(
        cluster, 'table')
    params = {
        'chart_id': 'read_requests_on_table',
        'chart_title': 'read requests on table',
        'request_dist': read_requests_dist_by_table,
        'base_url': '/monitor/table/',
    }

    read_requests_dist_by_table_chart = loader.get_template(
        'monitor/requests_dist_pie_chart.tpl').render(Context(params))

    params = {
        'chart_id': 'write_requests_on_table',
        'chart_title': 'write requests on table',
        'request_dist': write_requests_dist_by_table,
        'base_url': '/monitor/table/',
    }
    write_requests_dist_by_table_chart = loader.get_template(
        'monitor/requests_dist_pie_chart.tpl').render(Context(params))

    tables = dbutil.get_items_on_cluster(cluster, 'table', order_by='-qps')
    system_tables = [table for table in tables if is_system_table(table)]
    user_tables = [table for table in tables if not is_system_table(table)]

    table_read_item_keys = '|'.join(
        ['%s-readRequestsCountPerSec' % (table.name) for table in user_tables])
    table_write_item_keys = '|'.join([
        '%s-writeRequestsCountPerSec' % (table.name) for table in user_tables
    ])

    tsdb_read_query = []
    tsdb_write_query = []
    for table in user_tables:
        tsdb_read_query.append(
            metric_helper.make_metric_query(cluster.name, table.name,
                                            'readRequestsCountPerSec'))
        tsdb_write_query.append(
            metric_helper.make_metric_query(cluster.name, table.name,
                                            'writeRequestsCountPerSec'))

    params = {
        'cluster': cluster,
        'read_requests_dist_by_table_chart': read_requests_dist_by_table_chart,
        'write_requests_dist_by_table_chart':
        write_requests_dist_by_table_chart,
        'system_tables': system_tables,
        'user_tables': user_tables,
        'table_read_item_keys': table_read_item_keys,
        'table_write_item_keys': table_write_item_keys,
        'tsdb_read_query': tsdb_read_query,
        'tsdb_write_query': tsdb_write_query,
    }
    return respond(request, 'monitor/hbase_table_board.html', params)
Beispiel #6
0
def show_cluster_table_board(request, id):
    cluster = dbutil.get_cluster(id)
    if cluster.service.name != "hbase":
        # return empty paget for unsupported service
        return HttpResponse("")
    read_requests_dist_by_table, write_requests_dist_by_table = dbutil.get_requests_distribution_groupby(
        cluster, "table"
    )
    params = {
        "chart_id": "read_requests_on_table",
        "chart_title": "read requests on table",
        "request_dist": read_requests_dist_by_table,
        "base_url": "/monitor/table/",
    }

    read_requests_dist_by_table_chart = loader.get_template("monitor/requests_dist_pie_chart.tpl").render(
        Context(params)
    )

    params = {
        "chart_id": "write_requests_on_table",
        "chart_title": "write requests on table",
        "request_dist": write_requests_dist_by_table,
        "base_url": "/monitor/table/",
    }
    write_requests_dist_by_table_chart = loader.get_template("monitor/requests_dist_pie_chart.tpl").render(
        Context(params)
    )

    tables = dbutil.get_items_on_cluster(cluster, "table", order_by="-qps")
    system_tables = [table for table in tables if is_system_table(table)]
    user_tables = [table for table in tables if not is_system_table(table)]

    table_read_item_keys = "|".join(["%s-readRequestsCountPerSec" % (table.name) for table in user_tables])
    table_write_item_keys = "|".join(["%s-writeRequestsCountPerSec" % (table.name) for table in user_tables])

    tsdb_read_query = []
    tsdb_write_query = []
    for table in user_tables:
        tsdb_read_query.append(metric_helper.make_metric_query(cluster.name, table.name, "readRequestsCountPerSec"))
        tsdb_write_query.append(metric_helper.make_metric_query(cluster.name, table.name, "writeRequestsCountPerSec"))

    params = {
        "cluster": cluster,
        "read_requests_dist_by_table_chart": read_requests_dist_by_table_chart,
        "write_requests_dist_by_table_chart": write_requests_dist_by_table_chart,
        "system_tables": system_tables,
        "user_tables": user_tables,
        "table_read_item_keys": table_read_item_keys,
        "table_write_item_keys": table_write_item_keys,
        "tsdb_read_query": tsdb_read_query,
        "tsdb_write_query": tsdb_write_query,
    }
    return respond(request, "monitor/hbase_table_board.html", params)
Beispiel #7
0
def show_table(request, id):
  table = dbutil.get_table(id)
  cluster = table.cluster

  read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(table)
  params = {
    'chart_id': 'read_requests_on_rs',
    'chart_title': 'read requests on region',
    'request_dist': read_requests_dist_by_rs,
  }

  read_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'write_requests_on_rs',
    'chart_title': 'write requests on region',
    'request_dist': write_requests_dist_by_rs,
  }
  write_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(
    Context(params))

  memstore_size_dist_by_region, storefile_size_dist_by_region = dbutil.get_data_distribution(table)

  params = {
    'chart_id': 'memstore_size_dist_by_region',
    'chart_title': 'memstore size on region',
    'request_dist': memstore_size_dist_by_region,
    }
  memstore_size_dist_by_region_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'storefile_size_dist_by_region',
    'chart_title': 'storefile size on region',
    'request_dist': storefile_size_dist_by_region,
    }
  storefile_size_dist_by_region_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  group = str(table)
  tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, 'readRequestsCountPerSec')]
  tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, 'writeRequestsCountPerSec')]

  params = {
    'cluster': cluster,
    'table': table,
    'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart,
    'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart,
    'memstore_size_dist_by_region_chart': memstore_size_dist_by_region_chart,
    'storefile_size_dist_by_region_chart': storefile_size_dist_by_region_chart,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }

  return respond(request, 'monitor/hbase_table.html', params)
Beispiel #8
0
def show_cluster_table_board(request, id):
  cluster = dbutil.get_cluster(id)
  if cluster.service.name != 'hbase':
    # return empty paget for unsupported service
    return HttpResponse('')
  read_requests_dist_by_table, write_requests_dist_by_table = dbutil.get_requests_distribution_groupby(cluster, 'table');
  params = {
    'chart_id': 'read_requests_on_table',
    'chart_title': 'read requests on table',
    'request_dist': read_requests_dist_by_table,
    'base_url': '/monitor/table/',
  }

  read_requests_dist_by_table_chart = loader.get_template('monitor/requests_dist_pie_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'write_requests_on_table',
    'chart_title': 'write requests on table',
    'request_dist': write_requests_dist_by_table,
    'base_url': '/monitor/table/',
  }
  write_requests_dist_by_table_chart = loader.get_template('monitor/requests_dist_pie_chart.tpl').render(
    Context(params))

  tables = dbutil.get_items_on_cluster(cluster, 'table', order_by='-qps')
  system_tables = [table for table in tables if is_system_table(table)]
  user_tables = [table for table in tables if not is_system_table(table)]

  table_read_item_keys = '|'.join(['%s-readRequestsCountPerSec' % (table.name) for table in user_tables])
  table_write_item_keys ='|'.join(['%s-writeRequestsCountPerSec' % (table.name) for table in user_tables])

  tsdb_read_query = []
  tsdb_write_query = []
  for table in user_tables:
    tsdb_read_query.append(metric_helper.make_metric_query(cluster.name, table.name, 'readRequestsCountPerSec'))
    tsdb_write_query.append(metric_helper.make_metric_query(cluster.name, table.name, 'writeRequestsCountPerSec'))

  params = {
    'cluster': cluster,
    'read_requests_dist_by_table_chart': read_requests_dist_by_table_chart,
    'write_requests_dist_by_table_chart': write_requests_dist_by_table_chart,
    'system_tables': system_tables,
    'user_tables': user_tables,
    'table_read_item_keys': table_read_item_keys,
    'table_write_item_keys': table_write_item_keys,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }
  return respond(request, 'monitor/hbase_table_board.html', params)
Beispiel #9
0
def show_cluster_basic_board(request, id):
  cluster = dbutil.get_cluster(id)
  if cluster.service.name != 'hbase':
    # return empty paget for unsupported service
    return HttpResponse('')

  basic_info = dbutil.get_hbase_basic_info(cluster)

  group = 'Cluster'
  tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, 'readRequestsCountPerSec')]
  tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, 'writeRequestsCountPerSec')]

  params = {
    'cluster': cluster,
    'basic_info': basic_info,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }
  return respond(request, 'monitor/hbase_basic_board.html', params)
Beispiel #10
0
def show_service(request, id):
    service = dbutil.get_service(id)
    clusters = dbutil.get_clusters_by_service(id)
    params = {"service": service, "clusters": clusters}
    if service.name == "hbase":

        tsdb_read_query = []
        tsdb_write_query = []
        for cluster in clusters:
            tsdb_read_query.append(metric_helper.make_metric_query(cluster.name, "Cluster", "readRequestsCountPerSec"))
            tsdb_write_query.append(
                metric_helper.make_metric_query(cluster.name, "Cluster", "writeRequestsCountPerSec")
            )

        params.update({"tsdb_read_query": tsdb_read_query, "tsdb_write_query": tsdb_write_query})

        return respond(request, "monitor/hbase_service.html", params)
    else:
        return respond(request, "monitor/service.html", params)
Beispiel #11
0
def show_cluster_basic_board(request, id):
    cluster = dbutil.get_cluster(id)
    if cluster.service.name != "hbase":
        # return empty paget for unsupported service
        return HttpResponse("")

    basic_info = dbutil.get_hbase_basic_info(cluster)

    group = "Cluster"
    tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, "readRequestsCountPerSec")]
    tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, "writeRequestsCountPerSec")]

    params = {
        "cluster": cluster,
        "basic_info": basic_info,
        "tsdb_read_query": tsdb_read_query,
        "tsdb_write_query": tsdb_write_query,
    }
    return respond(request, "monitor/hbase_basic_board.html", params)
Beispiel #12
0
def show_table(request, id):
    table = dbutil.get_table(id)
    cluster = table.cluster

    read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(table)
    params = {
        "chart_id": "read_requests_on_rs",
        "chart_title": "read requests on region",
        "request_dist": read_requests_dist_by_rs,
    }

    read_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_column_chart.tpl").render(
        Context(params)
    )

    params = {
        "chart_id": "write_requests_on_rs",
        "chart_title": "write requests on region",
        "request_dist": write_requests_dist_by_rs,
    }
    write_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_column_chart.tpl").render(
        Context(params)
    )

    group = str(table)
    tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, "readRequestsCountPerSec")]
    tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, "writeRequestsCountPerSec")]

    params = {
        "cluster": cluster,
        "table": table,
        "read_requests_dist_by_rs_chart": read_requests_dist_by_rs_chart,
        "write_requests_dist_by_rs_chart": write_requests_dist_by_rs_chart,
        "tsdb_read_query": tsdb_read_query,
        "tsdb_write_query": tsdb_write_query,
    }

    return respond(request, "monitor/hbase_table.html", params)
Beispiel #13
0
def show_service(request, id):
  service = dbutil.get_service(id)
  clusters = dbutil.get_clusters_by_service(id)
  params = {
    'service': service,
    'clusters': clusters,
  }
  if service.name == 'hbase':

    tsdb_read_query = []
    tsdb_write_query = []
    for cluster in clusters:
      tsdb_read_query.append(metric_helper.make_metric_query(cluster.name, 'Cluster', 'readRequestsCountPerSec'))
      tsdb_write_query.append(metric_helper.make_metric_query(cluster.name, 'Cluster', 'writeRequestsCountPerSec'))

    params.update({
      'tsdb_read_query': tsdb_read_query,
      'tsdb_write_query': tsdb_write_query,
    })

    return respond(request, 'monitor/hbase_service.html', params)
  else:
    return respond(request, 'monitor/service.html', params)
Beispiel #14
0
def show_table(request, id):
    table = dbutil.get_table(id)
    cluster = table.cluster

    read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(
        table)
    params = {
        'chart_id': 'read_requests_on_rs',
        'chart_title': 'read requests on region',
        'request_dist': read_requests_dist_by_rs,
    }

    read_requests_dist_by_rs_chart = loader.get_template(
        'monitor/requests_dist_column_chart.tpl').render(Context(params))

    params = {
        'chart_id': 'write_requests_on_rs',
        'chart_title': 'write requests on region',
        'request_dist': write_requests_dist_by_rs,
    }
    write_requests_dist_by_rs_chart = loader.get_template(
        'monitor/requests_dist_column_chart.tpl').render(Context(params))

    memstore_size_dist_by_region, storefile_size_dist_by_region = dbutil.get_data_distribution(
        table)

    params = {
        'chart_id': 'memstore_size_dist_by_region',
        'chart_title': 'memstore size on region',
        'request_dist': memstore_size_dist_by_region,
    }
    memstore_size_dist_by_region_chart = loader.get_template(
        'monitor/requests_dist_column_chart.tpl').render(Context(params))

    params = {
        'chart_id': 'storefile_size_dist_by_region',
        'chart_title': 'storefile size on region',
        'request_dist': storefile_size_dist_by_region,
    }
    storefile_size_dist_by_region_chart = loader.get_template(
        'monitor/requests_dist_column_chart.tpl').render(Context(params))

    group = str(table)
    tsdb_read_query = [
        metric_helper.make_metric_query(cluster.name, group,
                                        'readRequestsCountPerSec')
    ]
    tsdb_write_query = [
        metric_helper.make_metric_query(cluster.name, group,
                                        'writeRequestsCountPerSec')
    ]

    params = {
        'cluster': cluster,
        'table': table,
        'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart,
        'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart,
        'memstore_size_dist_by_region_chart':
        memstore_size_dist_by_region_chart,
        'storefile_size_dist_by_region_chart':
        storefile_size_dist_by_region_chart,
        'tsdb_read_query': tsdb_read_query,
        'tsdb_write_query': tsdb_write_query,
    }

    return respond(request, 'monitor/hbase_table.html', params)