def show_cluster_regionserver_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_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution_groupby(cluster, 'regionserver'); params = { 'chart_id': 'read_requests_on_rs', 'chart_title': 'read requests on region server', 'request_dist': read_requests_dist_by_rs, 'base_url': '/monitor/regionserver/', } read_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_pie_chart.tpl').render(Context(params)) params = { 'chart_id': 'write_requests_on_rs', 'chart_title': 'write requests on region server', 'request_dist': write_requests_dist_by_rs, 'base_url': '/monitor/regionserver/', } write_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_pie_chart.tpl').render(Context(params)) regionservers = dbutil.get_items_on_cluster(cluster, 'regionserver', order_by='name') params = { 'cluster': cluster, 'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart, 'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart, 'regionservers': regionservers, } return respond(request, 'monitor/hbase_regionserver_board.html', params)
def show_cluster_regionserver_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_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution_groupby( cluster, "regionserver" ) params = { "chart_id": "read_requests_on_rs", "chart_title": "read requests on region server", "request_dist": read_requests_dist_by_rs, "base_url": "/monitor/regionserver/", } read_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_pie_chart.tpl").render(Context(params)) params = { "chart_id": "write_requests_on_rs", "chart_title": "write requests on region server", "request_dist": write_requests_dist_by_rs, "base_url": "/monitor/regionserver/", } write_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_pie_chart.tpl").render(Context(params)) regionservers = dbutil.get_items_on_cluster(cluster, "regionserver", order_by="name") params = { "cluster": cluster, "read_requests_dist_by_rs_chart": read_requests_dist_by_rs_chart, "write_requests_dist_by_rs_chart": write_requests_dist_by_rs_chart, "regionservers": regionservers, } return respond(request, "monitor/hbase_regionserver_board.html", params)
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)
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)
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)