# Do not output KeyboardInterrupt. signal.signal(signal.SIGINT, signal.SIG_DFL) # check log directory. if not os.path.exists(config.log_dir): os.mkdir(config.log_dir) # make logfile name(full path). logfile = config.log_dir + '/' + config.log_file # create logger(monitoring_api). if not os.path.exists(config.log_dir): os.mkdir(config.log_dir) logfile = config.log_dir + '/' + config.log_file logger = util.init_logger(const.MODULE_NAME_API,logfile) if not logger: sys.exit(1) # create topologyDB meta data. create_metadata(config.topology_db,config.db_addr ,config.db_port,config.db_user,config.db_pass,config.debug_flg) # run. if config.debug_flg == 1: logger.setLevel(logging.DEBUG) logger.info('(debug mode)' + start_msg) else: logger.setLevel(logging.INFO) logger.info(start_msg) outlog_confvalue(logger)
sched = BlockingScheduler() # Main function. if __name__ == '__main__': # start_msg = '{0} starting up (interval = {1}sec)...'.format(const.MODULE_NAME_COL,str(config.interval)) start_msg = '{0} starting up...'.format(const.MODULE_NAME_COL) # check log directory. if not os.path.exists(config.log_dir) : os.mkdir(config.log_dir) # make logfile name(full path). logfile = config.log_dir + '/' + config.log_file # create logger(monitoring_data_collector). logger = util.init_logger(const.MODULE_NAME_COL,logfile) if not logger: sys.exit(1) # create logger(scheduler). util.init_logger("apscheduler.executors.default",logfile) if config.debug_flg == 1 : logger.setLevel(logging.DEBUG) logger.info('(debug mode)' + start_msg) else : logger.setLevel(logging.INFO) logger.info(start_msg) # write the settings to the log file. outlog_confvalue(logger)
# Do not output KeyboardInterrupt. signal.signal(signal.SIGINT, signal.SIG_DFL) # check log directory. if not os.path.exists(config.log_dir): os.mkdir(config.log_dir) # make logfile name(full path). logfile = config.log_dir + '/' + config.log_file # create logger(monitoring_api). if not os.path.exists(config.log_dir): os.mkdir(config.log_dir) logfile = config.log_dir + '/' + config.log_file logger = util.init_logger(const.MODULE_NAME_API, logfile) if not logger: sys.exit(1) # create topologyDB meta data. create_metadata(config.topology_db, config.db_addr, config.db_port, config.db_user, config.db_pass, config.debug_flg) # run. if config.debug_flg == 1: logger.setLevel(logging.DEBUG) logger.info('(debug mode)' + start_msg) else: logger.setLevel(logging.INFO) logger.info(start_msg) outlog_confvalue(logger)