Ejemplo n.º 1
0
def main():
    """
    Test Lustre Performance Monitoring
    """
    # pylint: disable=unused-variable
    reload(sys)
    sys.setdefaultencoding("utf-8")

    if len(sys.argv) != 4:
        usage()
        sys.exit(-1)
    influx_server = sys.argv[1]
    influx_database = sys.argv[2]
    query_string = sys.argv[3]

    identity = time_util.local_strftime(time_util.utcnow(),
                                        "%Y-%m-%d-%H_%M_%S")

    print("Querying influxdb [%s] on server [%s] with query [%s] " %
          (influx_database, influx_server, query_string))
    utils.configure_logging()

    console_handler = utils.LOGGING_HANLDERS["console"]
    console_handler.setLevel(logging.DEBUG)

    ret = esmon_influxdb_query(influx_server, influx_database, query_string)
    if ret:
        logging.error("Influxdb query failed")
        sys.exit(ret)
    sys.exit(0)
Ejemplo n.º 2
0
def main():
    """
    Install virtual machines
    """
    # pylint: disable=unused-variable
    reload(sys)
    sys.setdefaultencoding("utf-8")
    config_fpath = ESMON_VIRT_CONFIG

    if len(sys.argv) == 2:
        config_fpath = sys.argv[1]
    elif len(sys.argv) > 2:
        usage()
        sys.exit(-1)

    identity = time_util.local_strftime(time_util.utcnow(), "%Y-%m-%d-%H_%M_%S")
    workspace = ESMON_VIRT_LOG_DIR + "/" + identity

    if not os.path.exists(ESMON_VIRT_LOG_DIR):
        os.mkdir(ESMON_VIRT_LOG_DIR)
    elif not os.path.isdir(ESMON_VIRT_LOG_DIR):
        logging.error("[%s] is not a directory", ESMON_VIRT_LOG_DIR)
        sys.exit(-1)

    if not os.path.exists(workspace):
        os.mkdir(workspace)
    elif not os.path.isdir(workspace):
        logging.error("[%s] is not a directory", workspace)
        sys.exit(-1)

    print("Started installing virtual machines using config [%s], "
          "please check [%s] for more log" %
          (config_fpath, workspace))
    utils.configure_logging(workspace)

    console_handler = utils.LOGGING_HANLDERS["console"]
    console_handler.setLevel(logging.DEBUG)

    save_fpath = workspace + "/" + ESMON_VIRT_CONFIG_FNAME
    logging.debug("copying config file from [%s] to [%s]", config_fpath,
                  save_fpath)
    shutil.copyfile(config_fpath, save_fpath)
    ret = esmon_virt(workspace, config_fpath)
    if ret:
        logging.error("installation failed, please check [%s] for more log\n",
                      workspace)
        sys.exit(ret)
    logging.info("Installed the virtual machines, please check [%s] "
                 "for more log", workspace)
    sys.exit(0)
Ejemplo n.º 3
0
def main():
    """
    Test Exascaler monitoring
    """
    # Some command out needs to be parsed, so make sure the language is
    # English.
    os.environ["LANG"] = "en_us"

    reload(sys)
    sys.setdefaultencoding("utf-8")
    config_fpath = ESMON_TEST_CONFIG

    if len(sys.argv) == 2:
        config_fpath = sys.argv[1]
    elif len(sys.argv) > 2:
        usage()
        sys.exit(-1)

    identity = time_util.local_strftime(time_util.utcnow(),
                                        "%Y-%m-%d-%H_%M_%S")
    workspace = ESMON_TEST_LOG_DIR + "/" + identity

    if not os.path.exists(ESMON_TEST_LOG_DIR):
        os.mkdir(ESMON_TEST_LOG_DIR)
    elif not os.path.isdir(ESMON_TEST_LOG_DIR):
        logging.error("[%s] is not a directory", ESMON_TEST_LOG_DIR)
        sys.exit(-1)

    if not os.path.exists(workspace):
        os.mkdir(workspace)
    elif not os.path.isdir(workspace):
        logging.error("[%s] is not a directory", workspace)
        sys.exit(-1)

    print("Started testing ESMON using config [%s], "
          "please check [%s] for more log" % (config_fpath, workspace))
    utils.configure_logging(workspace)

    console_handler = utils.LOGGING_HANLDERS["console"]
    console_handler.setLevel(logging.DEBUG)

    ret = esmon_test(workspace, config_fpath)
    if ret:
        logging.error("test failed, please check [%s] for more log\n",
                      workspace)
        sys.exit(ret)
    logging.info("Passed the ESMON tests, please check [%s] "
                 "for more log", workspace)
    sys.exit(0)
Ejemplo n.º 4
0
def main():
    """
    Generate I/O load for the Lustre file system
    """
    confpath = ESMON_TEST_CONFIG

    if len(sys.argv) == 2:
        confpath = sys.argv[1]
    elif len(sys.argv) > 2:
        usage()
        sys.exit(-1)

    identity = time_util.local_strftime(time_util.utcnow(),
                                        "%Y-%m-%d-%H_%M_%S")
    workspace = ESMON_TEST_LOG_DIR + "/" + identity

    if not os.path.exists(ESMON_TEST_LOG_DIR):
        os.mkdir(ESMON_TEST_LOG_DIR)
    elif not os.path.isdir(ESMON_TEST_LOG_DIR):
        logging.error("[%s] is not a directory", ESMON_TEST_LOG_DIR)
        sys.exit(-1)

    if not os.path.exists(workspace):
        os.mkdir(workspace)
    elif not os.path.isdir(workspace):
        logging.error("[%s] is not a directory", workspace)
        sys.exit(-1)

    print("Started I/O load testing for ESMON using config [%s], "
          "please check [%s] for more log" % (confpath, workspace))
    utils.configure_logging(workspace)

    console_handler = utils.LOGGING_HANLDERS["console"]
    console_handler.setLevel(logging.DEBUG)

    ret = esmon_ioload(workspace, confpath)
    if ret:
        logging.error("test failed, please check [%s] for more log\n",
                      workspace)
        sys.exit(ret)

    while True:
        time.sleep(10)

    logging.info(
        "Finished I/O load testing, please check [%s] "
        "for more log", workspace)
    sys.exit(0)
Ejemplo n.º 5
0
 def write(self, data):
     """
     Need unicode() otherwise will hit problem:
     TypeError: can't write str to text stream
     And also, even the encoding should be utf-8
     there will be some error, so need to ignore it.
     """
     # pylint: disable=bare-except
     self.wi_check_time = time_util.utcnow()
     data = unicode(data, encoding='utf-8', errors='ignore')
     try:
         super(WatchedIO, self).write(data)
     except:
         logging.error("failed to write the file [%s]: %s", self.wi_fname,
                       traceback.format_exc())
     self.wi_func(self.wi_args, data)
Ejemplo n.º 6
0
 def __init__(self, buffered_io, fname, func, args):
     super(WatchedIO, self).__init__(buffered_io)
     self.wi_check_time = time_util.utcnow()
     self.wi_func = func
     self.wi_args = args
     self.wi_fname = fname
Ejemplo n.º 7
0
def main():
    """
    Install Exascaler monitoring
    """
    # pylint: disable=unused-variable
    reload(sys)
    sys.setdefaultencoding("utf-8")
    config_fpath = ESMON_BUILD_CONFIG

    if len(sys.argv) == 2:
        config_fpath = sys.argv[1]
    elif len(sys.argv) > 2:
        usage()
        sys.exit(-1)

    identity = time_util.local_strftime(time_util.utcnow(),
                                        "%Y-%m-%d-%H_%M_%S")

    current_dir = os.getcwd()
    build_log_dir = "build_esmon"
    relative_workspace = build_log_dir + "/" + identity

    local_workspace = current_dir + "/" + relative_workspace
    local_log_dir = current_dir + "/" + build_log_dir
    if not os.path.exists(local_log_dir):
        os.mkdir(local_log_dir)
    elif not os.path.isdir(local_log_dir):
        logging.error("[%s] is not a directory", local_log_dir)
        sys.exit(-1)

    if not os.path.exists(local_workspace):
        os.mkdir(local_workspace)
    elif not os.path.isdir(local_workspace):
        logging.error("[%s] is not a directory", local_workspace)
        sys.exit(-1)

    config_fpath_exists = os.path.exists(config_fpath)
    if not config_fpath_exists:
        config_fpath = None
        print(
            "Started building Exascaler monitoring system using default config, "
            "please check [%s] for more log" % (local_workspace))
    else:
        print(
            "Started building Exascaler monitoring system using config [%s], "
            "please check [%s] for more log" % (config_fpath, local_workspace))
    utils.configure_logging(local_workspace)

    console_handler = utils.LOGGING_HANLDERS["console"]
    console_handler.setLevel(logging.DEBUG)

    if config_fpath_exists:
        save_fpath = local_workspace + "/" + ESMON_BUILD_CONFIG_FNAME
        logging.debug("copying config file from [%s] to [%s]", config_fpath,
                      save_fpath)
        shutil.copyfile(config_fpath, save_fpath)

    ret = esmon_build(current_dir, relative_workspace, config_fpath)
    if ret:
        logging.error("build failed")
        sys.exit(ret)
    logging.info("Exascaler monistoring system is successfully built")
    sys.exit(0)