@task
@requires_config(StandaloneConfig)
def system_info():
    if env.host not in fabricapi.get_coordinator_role():
        return
    err_msg = 'Unable to access node information. ' \
              'Please check that server is up with command: server status'
    req = get_request(request_url(NODES_REQUEST_EXT), err_msg)

    if not os.path.exists(TMP_PRESTO_DEBUG):
        os.mkdir(TMP_PRESTO_DEBUG)

    downloaded_sys_info_loc = os.path.join(TMP_PRESTO_DEBUG, "sysinfo")
    node_info_file_name = os.path.join(downloaded_sys_info_loc,
                                       'node_info.json')

    if not os.path.exists(downloaded_sys_info_loc):
        os.mkdir(downloaded_sys_info_loc)

    with open(node_info_file_name, 'w') as out_file:
        out_file.write(json.dumps(req.json(), indent=4))

    _LOGGER.debug('Gathered node information in file: ' + node_info_file_name)

    conn_file_name = os.path.join(downloaded_sys_info_loc,
                                  'connector_info.txt')
    client = PrestoClient(env.host, env.user)
    conn_info = get_connector_info_from(client)

    with open(conn_file_name, 'w') as out_file:
        out_file.write(conn_info + '\n')

    _LOGGER.debug('Gathered connector information in file: ' + conn_file_name)

    execute(get_system_info, downloaded_sys_info_loc, roles=env.roles)

    make_tarfile(OUTPUT_FILENAME_FOR_SYS_INFO, downloaded_sys_info_loc)
    print 'System info archive created: ' + OUTPUT_FILENAME_FOR_SYS_INFO
Gather system information like nodes in the system, presto
dataset/ETHPy150Open prestodb/presto-admin/prestoadmin/collect.py/system_info