def run(): # add file handler to logger prepare_logger(logger, file_name='statsenderd.log') logger.info("Starting standalone stats sender...") try: while True: StatsSender().send_stats_once() except (KeyboardInterrupt, SystemExit): logger.info("Stopping standalone stats sender...")
def run(): resource_type = sys.argv[1] # add file handler to log collecting for particular resource log_file = "oswl_{0}_collectord.log".format(resource_type) utils.prepare_logger(logger, log_file) poll_interval = settings.OSWL_COLLECTORS_POLLING_INTERVAL[resource_type] logger.info("Starting OSWL collector for {0} resource" .format(resource_type)) try: while True: if MasterNodeSettings.must_send_stats(): collect(resource_type) time.sleep(poll_interval) except (KeyboardInterrupt, SystemExit): logger.info("Stopping OSWL collector for {0} resource" .format(resource_type))