def view_cifs_shares(request): return_dict = {} try: return_dict['base_template'] = "shares_and_targets_base.html" return_dict["page_title"] = 'View CIFS shares' return_dict['tab'] = 'view_cifs_shares_tab' return_dict["error"] = 'Error viewing CIFS shares' shares_list, err = cifs_utils.get_shares_list() if err: raise Exception(err) if "ack" in request.GET: if request.GET["ack"] == "saved": conf = "Share information successfully updated" elif request.GET["ack"] == "created": conf = "Share successfully created" elif request.GET["ack"] == "deleted": conf = "Share successfully removed. Please note that the underlying data has not been removed." return_dict["ack_message"] = conf return_dict["shares_list"] = shares_list return django.shortcuts.render_to_response('view_cifs_shares.html', return_dict, context_instance=django.template.context.RequestContext(request)) except Exception, e: s = str(e) if "Another transaction is in progress".lower() in s.lower(): return_dict["error_details"] = "An underlying storage operation has locked a volume so we are unable to process this request. Please try after a couple of seconds" else: return_dict["error_details"] = "An error occurred when processing your request : %s" % s return django.shortcuts.render_to_response("logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
def view_cifs_shares(request): return_dict = {} try: template = 'logged_in_error.html' shares_list, err = cifs_common.get_shares_list() if err: raise Exception(err) if not "error" in return_dict: if "ack" in request.GET: if request.GET["ack"] == "saved": return_dict[ 'ack_message'] = "Share information successfully updated" elif request.GET["ack"] == "created": return_dict['ack_message'] = "Share successfully created" elif request.GET["ack"] == "deleted": return_dict['ack_message'] = "Share successfully deleted" return_dict["shares_list"] = shares_list template = "view_cifs_shares.html" return django.shortcuts.render_to_response( template, return_dict, context_instance=django.template.context.RequestContext(request)) except Exception, e: return_dict['base_template'] = "shares_base.html" return_dict["page_title"] = 'CIFS shares' return_dict['tab'] = 'view_cifs_shares_tab' return_dict["error"] = 'Error loading CIFS share list' return_dict["error_details"] = str(e) return django.shortcuts.render_to_response( "logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
def generate_smb_conf(): try: d, err = cifs_common.get_auth_settings() if err: raise Exception(err) smb_conf_path, err = config.get_smb_conf_path() if err: raise Exception(err) config_dir, err = config.get_config_dir() if err: raise Exception(err) # For customer specific or non configurable smb.conf lines extra_share_param_lines = None extra_global_param_lines = None if os.path.isfile('%s/customer_specific/extra_smb_share_params.conf' % config_dir): with open( '%s/customer_specific/extra_smb_share_params.conf' % config_dir, 'r') as f1: extra_share_param_lines = f1.readlines() if os.path.isfile('%s/customer_specific/extra_smb_global_params.conf' % config_dir): with open( '%s/customer_specific/extra_smb_global_params.conf' % config_dir, 'r') as f1: extra_global_param_lines = f1.readlines() # print extra_share_param_lines # print extra_global_param_lines with open("%s/smb.conf" % smb_conf_path, "w+") as f: ret, err = cifs_common.generate_global_header(f) if err: raise Exception(err) ret, err = _generate_integralstor_specific_global_section(f, d) if err: raise Exception(err) ret, err = cifs_common.generate_common_global_section( f, d, extra_global_param_lines) if err: raise Exception(err) shl, err = cifs_common.get_shares_list() if err: raise Exception(err) if shl: for share in shl: ret, err = _generate_share_section( f, share["name"], d["workgroup"], share["path"], share["read_only"], share["browseable"], share["comment"], d["security"], extra_share_param_lines, share['hosts_allow'], share['hosts_deny']) if err: raise Exception(err) ret, errors = reload_configuration() if errors: raise Exception(errors) except Exception, e: return False, 'Error generating CIFS configuration : %s' % str(e)
def generate_smb_conf(): """Generate the complete of smb.conf that is specific to gridcell Returns True on success and False otherwise """ try: d, err = cifs_utils.get_auth_settings() if err: raise Exception(err) smb_conf_path, err = config.get_smb_conf_path() if err: raise Exception(err) config_dir, err = config.get_config_dir() if err: raise Exception(err) # For customer specific or non configurable smb.conf lines extra_share_param_lines = None extra_global_param_lines = None if os.path.isfile('%s/customer_specific/extra_smb_share_params.conf' % config_dir): with open('%s/customer_specific/extra_smb_share_params.conf' % config_dir, 'r') as f1: extra_share_param_lines = f1.readlines() if os.path.isfile('%s/customer_specific/extra_smb_global_params.conf' % config_dir): with open('%s/customer_specific/extra_smb_global_params.conf' % config_dir, 'r') as f1: extra_global_param_lines = f1.readlines() # print extra_share_param_lines # print extra_global_param_lines with open("%s/smb.conf" % smb_conf_path, "w+") as f: ret, err = cifs_utils.generate_global_header(f) if err: raise Exception(err) ret, err = _generate_gridcell_specific_global_section(f, d) if err: raise Exception(err) ret, err = cifs_utils.generate_common_global_section( f, d, extra_global_param_lines) if err: raise Exception(err) ret, err = _generate_local_share(f) if err: raise Exception(err) shl, err = cifs_utils.get_shares_list() if err: raise Exception(err) if shl: for share in shl: ul = [] gl = [] if not share["guest_ok"]: vul, err = get_valid_users_list( share["share_id"]) if err: raise Exception(err) # print 'vul is ', vul if vul: for vu in vul: if vu["grp"]: gl.append(vu["name"]) else: ul.append(vu["name"]) share_dict = {} share_dict['share_name'] = share['name'] share_dict['vol_name'] = share['vol'] share_dict['workgroup'] = d['workgroup'] share_dict['path'] = share['path'] share_dict['read_only'] = share['read_only'] share_dict['browseable'] = share['browseable'] share_dict['guest_ok'] = share['guest_ok'] share_dict['comment'] = share['comment'] share_dict['auth_method'] = d['security'] share_dict['user_list'] = ul share_dict['group_list'] = gl ret, err = _generate_share_section( f, share_dict, extra_share_param_lines) if err: raise Exception(err) ret, errors = _reload_config() if errors: raise Exception(errors) except Exception, e: return False, 'Error generating CIFS configuration :%s' % str(e)
def dashboard(request): return_dict = {} try: return_dict['base_template'] = "dashboard_base.html" return_dict["page_title"] = 'Dashboard' return_dict['tab'] = 'dashboard_tab' return_dict["error"] = 'Error loading dashboard' gluster_lock, err = lock.get_lock('gluster_commands') if err: raise Exception(err) if not gluster_lock: raise Exception( 'This action cannot be performed as an underlying storage command is being run. Please retry this operation after a few seconds.' ) num_nodes_bad = 0 num_pools_bad = 0 num_vols_bad = 0 total_pool = 0 nodes = {} storage_pool = {} bad_nodes = [] bad_node_pools = [] bad_volumes = [] num_bad_ctdb_nodes = 0 bad_ctdb_nodes = [] num_quotas_exceeded = 0 soft_quota_exceeded_vols = [] hard_quota_exceeded_vols = [] num_shares = 0 si, err = system_info.load_system_config() if err: raise Exception(err) if not si: raise Exception('Could not obtain system information') total_nodes = len(si) for k, v in si.items(): nodes[k] = v["node_status"] if v["node_status"] != 0: num_nodes_bad += 1 bad_nodes.append(k) if v["in_cluster"]: total_pool += 1 if v["cluster_status"] != 1: num_pools_bad += 1 bad_node_pools.append(k) storage_pool[k] = v["cluster_status_str"] # Get all the volume info including process status and other status complete_vil, err = gluster_volumes.get_complete_volume_info_all() if err: raise Exception(err) total_vols = len(complete_vil) for vol in complete_vil: if vol["status"] == 1: if vol["data_access_status_code"] != 0 or ( not vol["processes_ok"]): bad_volumes.append(vol['name']) num_vols_bad += 1 if 'quotas' in vol and vol['quotas']: for k, v in vol['quotas'].items(): # print vol['name'], k, v if v: for quota_key, quota_val in v.items(): if quota_key.lower() in [ 'sl_exceeded', 'hl_exceeded' ] and quota_val.lower() == 'yes': if quota_key.lower() == 'sl_exceeded': soft_quota_exceeded_vols.append( vol['name']) if quota_key.lower() == 'hl_exceeded': hard_quota_exceeded_vols.append( vol['name']) num_quotas_exceeded += 1 # print soft_quota_exceeded_vols # print hard_quota_exceeded_vols shares_list, err = cifs_utils.get_shares_list() if err: raise Exception(err) if shares_list: num_shares = len(shares_list) return_dict['num_shares'] = num_shares targets_list, err = iscsi_stgt.get_targets() if err: raise Exception(err) if targets_list: return_dict['num_targets'] = len(targets_list) else: return_dict['num_targets'] = 0 ''' #Commenting out as we wont use ctdb for this build ctdb_status, err = ctdb.get_status() #print ctdb_status, err if err: raise Exception(err) if ctdb_status: num_ctdb_nodes = len(ctdb_status) for n, v in ctdb_status.items(): if v.lower() != 'ok': num_bad_ctdb_nodes += 1 return_dict["ctdb_status"] = ctdb_status ''' return_dict["num_quotas_exceeded"] = num_quotas_exceeded return_dict["soft_quota_exceeded_vols"] = soft_quota_exceeded_vols return_dict["hard_quota_exceeded_vols"] = hard_quota_exceeded_vols #return_dict["num_ctdb_nodes"] = num_ctdb_nodes return_dict["num_bad_ctdb_nodes"] = num_bad_ctdb_nodes return_dict["num_nodes_bad"] = num_nodes_bad return_dict["bad_nodes"] = bad_nodes return_dict["bad_node_pools"] = bad_node_pools return_dict["num_pools_bad"] = num_pools_bad return_dict["num_vols_bad"] = num_vols_bad return_dict["total_nodes"] = total_nodes return_dict["total_pool"] = total_pool return_dict["total_vols"] = total_vols return_dict["nodes"] = nodes return_dict['system_info'] = si return_dict['volume_info_list'] = complete_vil return_dict["storage_pool"] = storage_pool return django.shortcuts.render_to_response( 'view_dashboard.html', return_dict, context_instance=django.template.context.RequestContext(request)) except Exception, e: s = str(e) if "Another transaction is in progress".lower() in s.lower(): return_dict[ "error_details"] = "An underlying storage operation has locked a volume so we are unable to process this request. Please try after a couple of seconds" else: return_dict["error_details"] = s return django.shortcuts.render_to_response( "logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
def generate_smb_conf(): """Generate the complete of smb.conf that is specific to gridcell Returns True on success and False otherwise """ try: d, err = cifs_utils.get_auth_settings() if err: raise Exception(err) smb_conf_path, err = config.get_smb_conf_path() if err: raise Exception(err) config_dir, err = config.get_config_dir() if err: raise Exception(err) # For customer specific or non configurable smb.conf lines extra_share_param_lines = None extra_global_param_lines = None if os.path.isfile('%s/customer_specific/extra_smb_share_params.conf' % config_dir): with open( '%s/customer_specific/extra_smb_share_params.conf' % config_dir, 'r') as f1: extra_share_param_lines = f1.readlines() if os.path.isfile('%s/customer_specific/extra_smb_global_params.conf' % config_dir): with open( '%s/customer_specific/extra_smb_global_params.conf' % config_dir, 'r') as f1: extra_global_param_lines = f1.readlines() # print extra_share_param_lines # print extra_global_param_lines with open("%s/smb.conf" % smb_conf_path, "w+") as f: ret, err = cifs_utils.generate_global_header(f) if err: raise Exception(err) ret, err = _generate_gridcell_specific_global_section(f, d) if err: raise Exception(err) ret, err = cifs_utils.generate_common_global_section( f, d, extra_global_param_lines) if err: raise Exception(err) ret, err = _generate_local_share(f) if err: raise Exception(err) shl, err = cifs_utils.get_shares_list() if err: raise Exception(err) if shl: for share in shl: ul = [] gl = [] if not share["guest_ok"]: vul, err = get_valid_users_list(share["share_id"]) if err: raise Exception(err) # print 'vul is ', vul if vul: for vu in vul: if vu["grp"]: gl.append(vu["name"]) else: ul.append(vu["name"]) share_dict = {} share_dict['share_name'] = share['name'] share_dict['vol_name'] = share['vol'] share_dict['workgroup'] = d['workgroup'] share_dict['path'] = share['path'] share_dict['read_only'] = share['read_only'] share_dict['browseable'] = share['browseable'] share_dict['guest_ok'] = share['guest_ok'] share_dict['comment'] = share['comment'] share_dict['auth_method'] = d['security'] share_dict['user_list'] = ul share_dict['group_list'] = gl ret, err = _generate_share_section( f, share_dict, extra_share_param_lines) if err: raise Exception(err) ret, errors = _reload_config() if errors: raise Exception(errors) except Exception, e: return False, 'Error generating CIFS configuration :%s' % str(e)
def dashboard(request): return_dict = {} try: return_dict['base_template'] = "dashboard_base.html" return_dict["page_title"] = 'Dashboard' return_dict['tab'] = 'dashboard_tab' return_dict["error"] = 'Error loading dashboard' gluster_lock, err = lock.get_lock('gluster_commands') if err: raise Exception(err) if not gluster_lock: raise Exception( 'This action cannot be performed as an underlying storage command is being run. Please retry this operation after a few seconds.') num_nodes_bad = 0 num_pools_bad = 0 num_vols_bad = 0 total_pool = 0 nodes = {} storage_pool = {} bad_nodes = [] bad_node_pools = [] bad_volumes = [] num_bad_ctdb_nodes = 0 bad_ctdb_nodes = [] num_quotas_exceeded = 0 soft_quota_exceeded_vols = [] hard_quota_exceeded_vols = [] num_shares = 0 si, err = system_info.load_system_config() if err: raise Exception(err) if not si: raise Exception('Could not obtain system information') total_nodes = len(si) for k, v in si.items(): nodes[k] = v["node_status"] if v["node_status"] != 0: num_nodes_bad += 1 bad_nodes.append(k) if v["in_cluster"]: total_pool += 1 if v["cluster_status"] != 1: num_pools_bad += 1 bad_node_pools.append(k) storage_pool[k] = v["cluster_status_str"] # Get all the volume info including process status and other status complete_vil, err = gluster_volumes.get_complete_volume_info_all() if err: raise Exception(err) total_vols = len(complete_vil) for vol in complete_vil: if vol["status"] == 1: if vol["data_access_status_code"] != 0 or (not vol["processes_ok"]): bad_volumes.append(vol['name']) num_vols_bad += 1 if 'quotas' in vol and vol['quotas']: for k, v in vol['quotas'].items(): # print vol['name'], k, v if v: for quota_key, quota_val in v.items(): if quota_key.lower() in ['sl_exceeded', 'hl_exceeded'] and quota_val.lower() == 'yes': if quota_key.lower() == 'sl_exceeded': soft_quota_exceeded_vols.append( vol['name']) if quota_key.lower() == 'hl_exceeded': hard_quota_exceeded_vols.append( vol['name']) num_quotas_exceeded += 1 # print soft_quota_exceeded_vols # print hard_quota_exceeded_vols shares_list, err = cifs_utils.get_shares_list() if err: raise Exception(err) if shares_list: num_shares = len(shares_list) return_dict['num_shares'] = num_shares targets_list, err = iscsi_stgt.get_targets() if err: raise Exception(err) if targets_list: return_dict['num_targets'] = len(targets_list) else: return_dict['num_targets'] = 0 ''' #Commenting out as we wont use ctdb for this build ctdb_status, err = ctdb.get_status() #print ctdb_status, err if err: raise Exception(err) if ctdb_status: num_ctdb_nodes = len(ctdb_status) for n, v in ctdb_status.items(): if v.lower() != 'ok': num_bad_ctdb_nodes += 1 return_dict["ctdb_status"] = ctdb_status ''' return_dict["num_quotas_exceeded"] = num_quotas_exceeded return_dict["soft_quota_exceeded_vols"] = soft_quota_exceeded_vols return_dict["hard_quota_exceeded_vols"] = hard_quota_exceeded_vols #return_dict["num_ctdb_nodes"] = num_ctdb_nodes return_dict["num_bad_ctdb_nodes"] = num_bad_ctdb_nodes return_dict["num_nodes_bad"] = num_nodes_bad return_dict["bad_nodes"] = bad_nodes return_dict["bad_node_pools"] = bad_node_pools return_dict["num_pools_bad"] = num_pools_bad return_dict["num_vols_bad"] = num_vols_bad return_dict["total_nodes"] = total_nodes return_dict["total_pool"] = total_pool return_dict["total_vols"] = total_vols return_dict["nodes"] = nodes return_dict['system_info'] = si return_dict['volume_info_list'] = complete_vil return_dict["storage_pool"] = storage_pool return django.shortcuts.render_to_response('view_dashboard.html', return_dict, context_instance=django.template.context.RequestContext(request)) except Exception, e: s = str(e) if "Another transaction is in progress".lower() in s.lower(): return_dict["error_details"] = "An underlying storage operation has locked a volume so we are unable to process this request. Please try after a couple of seconds" else: return_dict["error_details"] = s return django.shortcuts.render_to_response("logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))
def view_dashboard(request, page): return_dict = {} try: return_dict["page_title"] = 'Overall system health' return_dict['tab'] = 'system_health_tab' return_dict["error"] = 'Error loading system health data' if request.method != 'GET': raise Exception('Invalid access method. Please use the menus') si, err = system_info.load_system_config() if err: raise Exception(err) if not si: raise Exception('Error loading system configuration') node_name = si.keys()[0] node = si[node_name] return_dict['node'] = node # print node.keys() # By default show error page template = "logged_in_error.html" # Chart specific declarations # will return 02, instead of 2. todays_date = (datetime.date.today()).strftime('%02d') start_hour = '%02d' % (datetime.datetime.today().hour - 3) end_hour = '%02d' % (datetime.datetime.today().hour) minute = '%02d' % (datetime.datetime.today().minute) start = str(start_hour) + ":" + str(minute) + str(":10") end = str(end_hour) + ":" + str(minute) + str(":40") value_list = [] time_list = [] num_bad_disks = 0 num_hw_raid_bad_disks = 0 num_hw_raid_ctrl_disks = 0 num_smart_ctrl_disks = 0 num_disks = len(node['disks']) disks_ok = True for sn, disk in node['disks'].items(): if 'status' in disk: if 'hw_raid' in disk: if not disk['hw_raid']: num_smart_ctrl_disks += 1 if (disk['status'] is not None and disk['status'].upper() not in ['PASSED', 'OK']): num_bad_disks += 1 disks_ok = False else: num_hw_raid_ctrl_disks += 1 if (disk['status'] is not None and disk['status'].upper() != 'OK'): num_hw_raid_bad_disks += 1 disks_ok = False else: # Assume its a non raid disk num_smart_ctrl_disks += 1 if (disk['status'] is not None and disk['status'].upper() not in ['PASSED', 'OK']): num_bad_disks += 1 disks_ok = False return_dict['num_disks'] = num_disks return_dict['num_bad_disks'] = num_bad_disks return_dict['disks_ok'] = disks_ok return_dict['num_hw_raid_bad_disks'] = num_hw_raid_bad_disks return_dict['num_hw_raid_ctrl_disks'] = num_hw_raid_ctrl_disks return_dict['num_smart_ctrl_disks'] = num_smart_ctrl_disks if 'ipmi_status' in node: num_sensors = len(node['ipmi_status']) num_bad_sensors = 0 ipmi_ok = True for sensor in node['ipmi_status']: if sensor['status'] in ['ok', 'nr', 'na']: continue else: num_bad_sensors += 1 ipmi_ok = False return_dict['num_sensors'] = num_sensors return_dict['num_bad_sensors'] = num_bad_sensors return_dict['ipmi_ok'] = ipmi_ok services_dict, err = services_management.get_sysd_services_status() if err: raise Exception(err) num_services = len(services_dict) num_failed_services = 0 num_active_services = 0 num_inactive_services = 0 services_ok = True if services_dict: for service, service_d in services_dict.items(): if service_d["info"]["status"]["status_str"] == "Active": num_active_services += 1 elif service_d["info"]["status"]["status_str"] == "Inactive": num_inactive_services += 1 elif service_d["info"]["status"]["status_str"] == "Failed": num_failed_services += 1 services_ok = False elif service_d["info"]["status"][ "status_str"] == "Unknown State": num_failed_services += 1 services_ok = False return_dict['num_services'] = num_services return_dict['num_active_services'] = num_active_services return_dict['num_inactive_services'] = num_inactive_services return_dict['num_failed_services'] = num_failed_services return_dict['services_ok'] = services_ok else: raise Exception('Error retrieving services status') pools, err = zfs.get_pools() if err: raise Exception(err) num_pools = len(pools) num_bad_pools = 0 num_degraded_pools = 0 num_high_usage_pools = 0 for pool in pools: if pool['usage']['capacity']['value'] > 75: num_high_usage_pools += 1 if pool['config']['pool']['root']['status']['state'] == 'ONLINE': pass elif pool['config']['pool']['root']['status'][ 'state'] == 'DEGRADED': num_degraded_pools += 1 else: num_bad_pools += 1 return_dict['num_pools'] = num_pools return_dict['num_bad_pools'] = num_bad_pools return_dict['num_degraded_pools'] = num_degraded_pools return_dict['num_high_usage_pools'] = num_high_usage_pools load_avg_ok = True if (node["load_avg"]["5_min"] > node["load_avg"]["cpu_cores"]) or ( node["load_avg"]["15_min"] > node["load_avg"]["cpu_cores"]): load_avg_ok = False return_dict['load_avg_ok'] = load_avg_ok shares_list, err = cifs_common.get_shares_list() if err: raise Exception(err) return_dict['num_cifs_shares'] = len(shares_list) exports_list, err = nfs.load_exports_list() if err: raise Exception(err) return_dict['num_nfs_exports'] = len(exports_list) target_list, err = iscsi_stgt.get_targets() if err: raise Exception(err) return_dict['num_iscsi_targets'] = len(target_list) with open('/proc/uptime', 'r') as f: uptime_seconds = float(f.readline().split()[0]) uptime_str = '%s hours' % (':'.join( str(timedelta(seconds=uptime_seconds)).split(':')[:2])) return_dict['uptime_str'] = uptime_str # CPU status if page == "cpu": return_dict["page_title"] = 'CPU statistics' return_dict['tab'] = 'cpu_tab' return_dict["error"] = 'Error loading CPU statistics' cpu, err = stats.get_system_stats(todays_date, start, end, "cpu") if err: raise Exception(err) value_dict = {} if cpu: for key in cpu.keys(): value_list = [] time_list = [] if key == "date": pass else: if cpu[key]: for a in cpu[key]: time_list.append(a[0]) value_list.append(a[1]) value_dict[key] = value_list return_dict["data_dict"] = value_dict queue, err = stats.get_system_stats(todays_date, start, end, "queue") if err: raise Exception(err) value_dict = {} if queue: for key in queue.keys(): value_list = [] time_list = [] if key == "date": pass else: for a in queue[key]: time_list.append(a[0]) value_list.append(a[1]) value_dict[key] = value_list return_dict["data_dict_queue"] = value_dict return_dict['node_name'] = node_name return_dict['node'] = si[node_name] d = {} template = "view_cpu_stats.html" elif page == "sys_health": return_dict["page_title"] = 'Overall system health' return_dict['tab'] = 'system_health_tab' return_dict["error"] = 'Error loading system health data' template = "view_dashboard.html" hw_platform, err = config.get_hardware_platform() if hw_platform: return_dict['hw_platform'] = hw_platform if hw_platform == 'dell': from integralstor_utils.platforms import dell idrac_url, err = dell.get_idrac_addr() if idrac_url: return_dict['idrac_url'] = idrac_url # Memory elif page == "memory": return_dict["page_title"] = 'Memory statistics' return_dict['tab'] = 'memory_tab' return_dict["error"] = 'Error loading memory statistics' mem, err = stats.get_system_stats(todays_date, start, end, "memory") if err: raise Exception(err) if mem: for a in mem["memused"]: time_list.append(a[0]) value_list.append((a[1] / (1024 * 1024))) return_dict['memory_status'] = si[node_name]['memory'] template = "view_memory_stats.html" # Network elif page == "network": return_dict["page_title"] = 'Network statistics' return_dict['tab'] = 'network_tab' return_dict["error"] = 'Error loading Network statistics' network, err = stats.get_system_stats(todays_date, start, end, "network") if err: raise Exception(err) value_dict = {} if network: for key in network.keys(): value_list = [] time_list = [] if key == "date" or key == "lo": pass else: for a in network[key]["ifutil-percent"]: time_list.append(a[0]) value_list.append(a[1]) value_dict[key] = value_list return_dict["data_dict"] = value_dict return_dict["network_status"] = si[node_name]['interfaces'] template = "view_network_stats.html" return_dict["labels"] = time_list return_dict["data"] = value_list return django.shortcuts.render_to_response( template, return_dict, context_instance=django.template.context.RequestContext(request)) except Exception, e: return_dict['base_template'] = "dashboard_base.html" return_dict["error_details"] = str(e) return django.shortcuts.render_to_response( "logged_in_error.html", return_dict, context_instance=django.template.context.RequestContext(request))