Пример #1
0
def home(request):
    job_bytes = Job.get_bytes_from_last_jobs()
    grafico_backup_dados = {
        'title': u"Quantidade de dados realizados backup", 'width': "100%",
        'type': "bar",
        'cid': "chart1",
        'header': [d.strftime("%d/%m/%y") for d in sorted(job_bytes)],
        'labels': [utils.filesizeformat(v) for k, v in sorted(job_bytes.items())],
        'lines': {
            "Dados": utils.ordered_dict_value_to_formatted_float(job_bytes)
        }
    }

    job_files = Job.get_files_from_last_jobs()
    grafico_backup_arquivos = {
        'title': u"Quantidade de arquivos realizados backup", 'width': "100%",
        'type': "bar",
        'cid': "chart2",
        'header': [d.strftime("%d/%m/%y") for d in sorted(job_files)],
        'labels': [int(v) for k, v in sorted(job_files.items())],
        'lines': {
            "Arquivos": [int(v) for k, v in sorted(job_files.items())]
        }
    }

    graphics = Graphics()
    blocks = graphics.render_blocks()

    memory = systeminfo.get_memory_usage()
    memory_free = 100 - memory

    grafico_uso_memoria = {'title': u"Uso da memória", 'width': "90%", 'type': "pie", 'cid': "chart4", 'header': ["Gigabytes"],
              'lines': {
                  "Disponível": [memory_free],
                  "Ocupado": [memory]}}

    cpu = systeminfo.get_cpu_usage()
    cpu_free = 100 - memory


    grafico_uso_cpu = {'title': u"Uso da CPU", 'width': "", "type": "pie", 'cid': "chart5", 'header': ["Clocks"], 'lines': {
        "Disponível": [cpu_free],
        "Ocupado": [cpu]}}

    # Dados de content:
    # - type
    # - label
    # - date
    # - message

    last_jobs = Procedure.all_non_self_jobs()[:5]

    return render_to_response(request, "home.html", locals())
Пример #2
0
def history(request, object_id=False):
    #TODO: Filtrar jobs de um procedimento específico
    title = u'Histórico de Procedimentos'
    # get page number
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    #get all jobs
    all_jobs = Procedure.all_non_self_jobs()
    paginator = Paginator(all_jobs, 20)
    try:
        jobs = paginator.page(page)
    except (EmptyPage, InvalidPage):
        jobs = paginator.page(paginator.num_pages)
    last_jobs = jobs.object_list
    return render_to_response(request, "procedures_history.html", locals())
Пример #3
0
def history(request, object_id=False):
    #TODO: Filtrar jobs de um procedimento específico
    title = u'Histórico de Procedimentos'
    # get page number
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    #get all jobs
    all_jobs = Procedure.all_non_self_jobs()
    paginator = Paginator(all_jobs, 20)
    try:
        jobs = paginator.page(page)
    except (EmptyPage, InvalidPage):
        jobs = paginator.page(paginator.num_pages)
    last_jobs = jobs.object_list
    return render_to_response(request, "procedures_history.html", locals())
Пример #4
0
def home(request):
    job_bytes = Job.get_bytes_from_last_jobs()
    table1 = {
        'title': u"Quantidade de dados realizados backup",
        'width': "100%",
        'type': "bar",
        'cid': "chart1",
        'header': [d.strftime("%d/%m/%y") for d in sorted(job_bytes)],
        'labels':
        [utils.filesizeformat(v) for k, v in sorted(job_bytes.items())],
        'lines': {
            "Dados": utils.ordered_dict_value_to_formatted_float(job_bytes)
        }
    }

    job_files = Job.get_files_from_last_jobs()
    table2 = {
        'title': u"Quantidade de arquivos realizados backup",
        'width': "100%",
        'type': "bar",
        'cid': "chart2",
        'header': [d.strftime("%d/%m/%y") for d in sorted(job_files)],
        'labels': [int(v) for k, v in sorted(job_files.items())],
        'lines': {
            "Arquivos": [int(v) for k, v in sorted(job_files.items())]
        }
    }

    graphsdata.update_disk_graph()
    graph_data_manager = graphsdata.GraphDataManager()
    diskdata = graph_data_manager.list_disk_measures()

    table3 = {
        'title': u"Ocupação do disco (GB)",
        'width': "",
        'type': "area",
        'cid': "chart3",
        'height': "200",
        'header': [i[0] for i in diskdata],
        'labels': [utils.filesizeformat(i[1], "GB") for i in diskdata]
    }
    #table3['header'] = ["Gigabytes"]
    #setando valor padrao
    t3data = [utils.filesizeformat(i[1], "GB")
              for i in diskdata] if len(diskdata) else [0.0]
    table3['lines'] = {"Disponível": t3data}

    memory = systeminfo.get_memory_usage()
    memory_free = 100 - memory

    table4 = {
        'title': u"Uso da memória",
        'width': "90%",
        'type': "pie",
        'cid': "chart4",
        'header': ["Gigabytes"],
        'lines': {
            "Disponível": [memory_free],
            "Ocupado": [memory]
        }
    }

    cpu = systeminfo.get_cpu_usage()
    cpu_free = 100 - memory

    table5 = {
        'title': u"Uso da CPU",
        'width': "",
        "type": "pie",
        'cid': "chart5",
        'header': ["Clocks"],
        'lines': {
            "Disponível": [cpu_free],
            "Ocupado": [cpu]
        }
    }

    # Dados de content:
    # - type
    # - label
    # - date
    # - message

    last_jobs = Procedure.all_non_self_jobs()[:5]

    return render_to_response(request, "home.html", locals())
Пример #5
0
def list_all(request):
    procedures = Procedure.objects.filter(id__gt=1)
    title = u"Procedimentos de backup"
    last_jobs = Procedure.all_non_self_jobs()[:10]
    return render_to_response(request, "procedures_list.html", locals())
Пример #6
0
def home(request):
    job_bytes = Job.get_bytes_from_last_jobs()
    table1 = {
        "title": u"Quantidade de dados realizados backup",
        "width": "100%",
        "type": "bar",
        "cid": "chart1",
        "header": [d.strftime("%d/%m/%y") for d in sorted(job_bytes)],
        "labels": [utils.filesizeformat(v) for k, v in sorted(job_bytes.items())],
        "lines": {"Dados": utils.ordered_dict_value_to_formatted_float(job_bytes)},
    }

    job_files = Job.get_files_from_last_jobs()
    table2 = {
        "title": u"Quantidade de arquivos realizados backup",
        "width": "100%",
        "type": "bar",
        "cid": "chart2",
        "header": [d.strftime("%d/%m/%y") for d in sorted(job_files)],
        "labels": [int(v) for k, v in sorted(job_files.items())],
        "lines": {"Arquivos": [int(v) for k, v in sorted(job_files.items())]},
    }

    graphsdata.update_disk_graph()
    graph_data_manager = graphsdata.GraphDataManager()
    diskdata = graph_data_manager.list_disk_measures()

    table3 = {
        "title": u"Ocupação do disco (GB)",
        "width": "",
        "type": "area",
        "cid": "chart3",
        "height": "200",
        "header": [i[0] for i in diskdata],
        "labels": [utils.filesizeformat(i[1], "GB") for i in diskdata],
    }
    # table3['header'] = ["Gigabytes"]
    # setando valor padrao
    t3data = [utils.filesizeformat(i[1], "GB") for i in diskdata] if len(diskdata) else [0.0]
    table3["lines"] = {"Disponível": t3data}

    memory = systeminfo.get_memory_usage()
    memory_free = 100 - memory

    table4 = {
        "title": u"Uso da memória",
        "width": "90%",
        "type": "pie",
        "cid": "chart4",
        "header": ["Gigabytes"],
        "lines": {"Disponível": [memory_free], "Ocupado": [memory]},
    }

    cpu = systeminfo.get_cpu_usage()
    cpu_free = 100 - memory

    table5 = {
        "title": u"Uso da CPU",
        "width": "",
        "type": "pie",
        "cid": "chart5",
        "header": ["Clocks"],
        "lines": {"Disponível": [cpu_free], "Ocupado": [cpu]},
    }

    # Dados de content:
    # - type
    # - label
    # - date
    # - message

    last_jobs = Procedure.all_non_self_jobs()[:5]

    return render_to_response(request, "home.html", locals())
Пример #7
0
def list_all(request):
    procedures = Procedure.objects.filter(id__gt=1)
    title = u"Procedimentos de backup"
    last_jobs = Procedure.all_non_self_jobs()[:10]
    return render_to_response(request, "procedures_list.html", locals())