Exemplo n.º 1
0
def admin_page(request):
    tintri = Tintri()

    tintri_context = {

        'tabs': TabGroup(
            template_dir='tintri/templates',
            context={
                "endpoint": tintri.get_connection_info(),
                "clone_from_snapshot": tintri.get_or_create_clone_from_snapshot_server_action(),
                "take_snapshot": tintri.get_or_create_take_snapshot_server_action(),
                "delete_snapshot": tintri.get_or_create_delete_snapshot_server_action()
            },
            request=request,
            tabs=[
                # First tab uses template 'groups/tabs/tab-main.html'
                #(_("Configuration"), 'configuration', {}),

                # Tab 2 is conditionally-shown in this slot and
                # uses template 'groups/tabs/tab-related-items.html'
                (_("Overview"), 'overview', {}),
            ],
        )
    }
    return render(request, 'tintri/templates/admin_page.html', tintri_context)
Exemplo n.º 2
0
def admin_page(request):
    solar_winds_manager = SolarWindsManager()
    try:
        solar_winds_ci = solar_winds_manager.get_solar_winds_rest_ci()
    except Exception:
        solar_winds_ci = None

    try:
        solar_winds_server_ci = solar_winds_manager.get_solar_winds_server_ci()
    except Exception:
        solar_winds_server_ci = None

    nodes = solar_winds_manager.get_solar_winds_nodes()
    if nodes:
        for node in nodes:
            server = Server.objects.filter(
                hostname__icontains=node.get('NodeName'), ip=node.get('IPAddress')).first()
            if server:
                node['environment'] = server.environment.name
                node['server_url'] = server.get_absolute_url()

    solar_winds_context = {
        'tabs': TabGroup(
            template_dir='solar_winds/templates',
            request=request,
            tabs=[
                (_("Overview"), 'dashboard', dict(
                    context={"solar_winds_ci": solar_winds_ci, "solar_winds_server_ci": solar_winds_server_ci})),
                (_("Servers"), 'servers', dict(
                    context={'nodes': nodes}))
            ],
        )
    }
    return render(request, 'solar_winds/templates/admin_page.html', solar_winds_context)
Exemplo n.º 3
0
def admin_page(request):
    cloud_endure_manager = CloudEndureManager()
    cloudendure_ci = cloud_endure_manager.get_connection_info()
    machines = cloud_endure_manager.get_all_servers()
    projects = cloud_endure_manager.get_all_projects(more_info=True)
    jobs = cloud_endure_manager.get_all_jobs()

    if machines:
        for machine in machines:
            server = Server.objects.filter(
                hostname__icontains=machine.get('name')).first()
            if server:
                machine['environment'] = server.environment.name
                machine['server_url'] = server.get_absolute_url()
                machine['ip'] = server.ip
    cloudendure_context = {
        'tabs':
        TabGroup(
            template_dir='cloudendure/templates',
            request=request,
            tabs=[(_("Dashboard"), 'dashboard',
                   dict(context={"cloudendure_ci": cloudendure_ci})),
                  (_("Servers"), 'servers',
                   dict(context={'machines': machines})),
                  (_("Projects"), 'projects',
                   dict(context={'projects': projects})),
                  (_("Jobs"), 'jobs', dict(context={'jobs': jobs}))],
        )
    }
    return render(request, 'cloudendure/templates/admin_page.html',
                  cloudendure_context)
Exemplo n.º 4
0
def admin_page(request):
    office_context = {
        'tabs':
        TabGroup(
            template_dir='office365/templates',
            request=request,
            tabs=[
                (_("Dashboard"), 'dashboard',
                 dict(context={
                     "office_ci": Office365Manager.get_connection_info()
                 })),
            ],
        )
    }
    return render(request, 'office365/templates/admin_page.html',
                  office_context)
Exemplo n.º 5
0
def admin_page(request):
    data_dog = None
    hosts = []
    try:
        data_dog = DataDog()
        api_key = data_dog.get_api_key()
        app_key = data_dog.get_app_key()
        url = data_dog.generate_url("hosts")
        response = requests.get(url,
                                params={
                                    'api_key': api_key,
                                    'application_key': app_key
                                })
        res = response.json()
        for host in res['host_list']:
            res_dict = {}
            res_dict['name'] = host['name']
            res_dict['os'] = host['meta']['platform']
            res_dict['sources'] = host['sources']
            res_dict['up'] = host['up']
            res_dict['ipaddress'] = json.loads(
                host['meta']['gohai'])['network']['ipaddress']
            res_dict['agent_version'] = host['meta']['agent_version']
            server = Server.objects.filter(hostname__icontains=host['name'],
                                           ip=res_dict['ipaddress']).first()
            if server is not None:
                res_dict['server_url'] = server.get_absolute_url()
            hosts.append(res_dict)
    except Exception:
        pass

    data_dog_context = {
        'tabs':
        TabGroup(
            template_dir='data_dog/templates',
            request=request,
            tabs=[
                (_("Dashboard"), 'dashboard',
                 dict(
                     context={"data_dog_ci": data_dog.get_connection_info()})),
                (_("Servers"), 'servers', dict(context={"res": hosts})),
            ],
        )
    }
    return render(request, 'data_dog/templates/admin_page.html',
                  data_dog_context)
Exemplo n.º 6
0
def admin_page(request):
    new_relic_manager = NewRelicManager()
    new_relic_ci = new_relic_manager.get_connection_info()

    new_relic_context = {
        'tabs':
        TabGroup(
            template_dir='new_relic/templates',
            request=request,
            tabs=[
                (_("Overview"), 'dashboard',
                 dict(context={"new_relic_ci": new_relic_ci})),
            ],
        )
    }
    return render(request, 'new_relic/templates/admin_page.html',
                  new_relic_context)
Exemplo n.º 7
0
def admin_page(request):
    openshift = OpenshiftManager()
    openshift_ci = openshift.get_connection_info()

    openshift_context = {
        'tabs':
        TabGroup(
            template_dir='openshift/templates',
            context={'openshift_ci': openshift_ci},
            request=request,
            tabs=[
                # First tab uses template 'groups/tabs/tab-main.html'
                # (_("Configuration"), 'configuration', {}),
                # Tab 2 is conditionally-shown in this slot and
                # uses template 'groups/tabs/tab-related-items.html'
                (_("Dashboard"), 'dashboard', dict(context={})),
            ],
        )
    }
    return render(request, 'openshift/templates/admin_page.html',
                  openshift_context)
Exemplo n.º 8
0
def admin_page(request):
    veeam = VeeamManager()
    endpoint = veeam.get_connection_info()
    # If no Connection info, show a dialog for adding a connection info.
    if not endpoint:
        veeam_context = {
            'tabs':
            TabGroup(
                template_dir='veeam/templates',
                context={},
                request=request,
                tabs=[(_(""), 'dashboard', dict(context={}))],
            )
        }
        return render(request, 'veeam/templates/admin_page.html',
                      veeam_context)

    jobs = veeam.get_jobs()
    backups = veeam.get_backups()
    summary = veeam.get_summary()

    context = {}
    ip = veeam.get_connection_info().ip
    try:
        server = Server.objects.get(ip=ip)
    except Exception:
        messages.error(request,
                       message="The server running Veeam could not be found.")
        return render(request, 'veeam/templates/admin_page.html', {})

    restore_to_ec2_job = server.jobs.filter(
        job_parameters__hookparameters__hook__name='Restore Veeam Backup To EC2'
    ).last()

    restore_to_ec2_job_running = False
    if restore_to_ec2_job and restore_to_ec2_job.is_active():
        restore_to_ec2_job_running = True
        context.update(
            {'restore_to_ec2_job_url': restore_to_ec2_job.get_absolute_url()})
    context.update({'restore_to_ec2_job_running': restore_to_ec2_job_running})

    restore_to_azure_job = server.jobs.filter(
        job_parameters__hookparameters__hook__name=
        'Restore Veeam Backup To Azure').last()
    restore_to_azure_job_running = False
    if restore_to_azure_job and restore_to_azure_job.is_active():
        restore_to_azure_job_running = True
        context.update({
            'restore_to_azure_job_url':
            restore_to_azure_job.get_absolute_url()
        })
    context.update(
        {'restore_to_azure_job_running': restore_to_azure_job_running})

    context.update({'jobs': jobs, 'backups': backups, 'endpoint': endpoint})

    veeam_context = {
        'tabs':
        TabGroup(
            template_dir='veeam/templates',
            context=context,
            request=request,
            tabs=[
                # First tab uses template 'groups/tabs/tab-main.html'
                # (_("Configuration"), 'configuration', {}),
                # Tab 2 is conditionally-shown in this slot and
                # uses template 'groups/tabs/tab-related-items.html'
                (_("Dashboard"), 'dashboard', dict(context=summary)),
                (_("Jobs"), 'jobs', {}),
                (_("Backups"), 'backups', {})
            ],
        )
    }
    return render(request, 'veeam/templates/admin_page.html', veeam_context)