def ajax(request): data = collections.OrderedDict() cpu_count = percore_cpu() coredata = collections.OrderedDict() for core in cpu_count: coredata[core[0]] = core[1] data = coredata return HttpResponse(json.dumps(data), content_type="application/json")
def monitor(request): cpu_count = percore_cpu() server_list = Server.objects.all() context = {'server_list': server_list, 'cpu_count': cpu_count} return render(request, 'dashboard/monitor.html', context)