def index(request): # show all business businesses = Business.objects.all() params = { 'businesses': businesses, } return respond(request, 'business/index.html', params)
def index(request): # show all cluster longhauls = Longhaul.objects.all() params = { 'longhauls': longhauls, } return respond(request, 'hbase/index.html', params)
def index(request, addrs, path=""): path = "/" + path try: parent_path = os.path.dirname(path) znode = ZNode(addrs, path) znode.children.sort() if not istext(znode.data): znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data]) znode.datatype = "bin" else: znode.datatype = "str" params = {'znode': znode, 'addrs': addrs, 'parent_path': parent_path} return respond(request, 'zktree/index.html', params) except Exception as err: return respond(request, 'zktree/error.html', {'error': str(err)})
def index(request, addrs, path=""): path = "/" + path try: parent_path = os.path.dirname(path) znode = ZNode(addrs, path) znode.children.sort() if not istext(znode.data): znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data]) znode.datatype = "bin" else: znode.datatype = "str" params = {'znode':znode, 'addrs':addrs, 'parent_path':parent_path} return respond(request, 'zktree/index.html', params) except Exception as err: return respond(request, 'zktree/error.html', {'error':str(err)})
def show_online(request, id, access_type, label): business = Business.objects.get(id=id) metrics = get_online_counters(access_type, label) params = { 'business_id' : id, 'write_menus' : ONLINE_METRICS_MENU_CONFIG['Online Write'], 'read_menus' : ONLINE_METRICS_MENU_CONFIG['Online Read'], 'metrics' : metrics, 'business': business, } return respond(request, 'business/online.html', params)
def show_online(request, id, access_type, label): business = Business.objects.get(id=id) metrics = get_online_counters(access_type, label) params = { 'business_id': id, 'write_menus': ONLINE_METRICS_MENU_CONFIG['Online Write'], 'read_menus': ONLINE_METRICS_MENU_CONFIG['Online Read'], 'metrics': metrics, 'business': business, } return respond(request, 'business/online.html', params)
def show_longhaul(request, id): longhaul = Longhaul.objects.get(id=id) group = longhaul.getCounterGroup() counters = get_counters_by_group(group) endpoint = 'unknown' counter_names = [] for counter in counters: endpoint = counter.host counter_names.append(group + '-' + counter.name) params = { 'endpoint': endpoint, 'counter_names': counter_names, 'longhaul': longhaul, } return respond(request, 'hbase/longhaul.html', params)
def show_business(request, id, access_type, label): business = Business.objects.get(id=id) group = business.getCounterGroup() endpoint = get_endpoint(group, access_type) metric_names = [] if label == HBASE_OPERATION_LABEL: metric_names = get_counter_name_of_hbase_operation(group, access_type) else: metric_names = get_counter_name(group, access_type, label) params = { 'business_id' : id, 'endpoint': endpoint, 'write_menus' : BUSINESS_METRICS_VIEW_CONFIG['Write HBase'], 'read_menus' : BUSINESS_METRICS_VIEW_CONFIG['Read HBase'], 'metric_names' : metric_names, 'business': business, } return respond(request, 'business/business.html', params)
def show_business(request, id, access_type, label): business = Business.objects.get(id=id) group = business.getCounterGroup() endpoint = get_endpoint(group, access_type) metric_names = [] if label == HBASE_OPERATION_LABEL: metric_names = get_counter_name_of_hbase_operation(group, access_type) else: metric_names = get_counter_name(group, access_type, label) params = { 'business_id': id, 'endpoint': endpoint, 'write_menus': BUSINESS_METRICS_VIEW_CONFIG['Write HBase'], 'read_menus': BUSINESS_METRICS_VIEW_CONFIG['Read HBase'], 'metric_names': metric_names, 'business': business, } return respond(request, 'business/business.html', params)