Exemplo n.º 1
0
 def get(self, request):
     host_id = request.GET.get('host_id')
     host_obj = models.Host.objects.filter(id=host_id)
     hs = graphs.GraphGenerator2(host_obj,
                                 many=True,
                                 context={
                                     'request': request,
                                     'redis_obj': REDIS_OBJ
                                 })
     data = hs.data
     return Response(data)
Exemplo n.º 2
0
def graphs_gerator(request):
    """
    获取一台主机的所有数据
    :param request:
    :return:
    """
    graphs_generator = graphs.GraphGenerator2(REDIS_CONN)
    print("GET================================================", request.GET)
    graphs_data = graphs_generator.get_host_graph(
        request.GET.get('host_id'), request.GET.get('time_range'))

    return HttpResponse(json.dumps(graphs_data))
Exemplo n.º 3
0
def graphs_gerator(request):

    graphs_generator = graphs.GraphGenerator2(request,REDIS_OBJ)
    graphs_data = graphs_generator.get_host_graph()
    print("graphs_data",graphs_data)
    return HttpResponse(json.dumps(graphs_data))
Exemplo n.º 4
0
def graphs_gerator(request):

    graphs_generator = graphs.GraphGenerator2(request, REDIS_OBJ)
    graphs_data = graphs_generator.get_host_graph()
    # print(type(graphs_data),graphs_data)
    return HttpResponse(graphs_data)