def start(self):
            # The Agent Configurations. See umit/inventory/agent/Configs.py
            # for details regarding the configuration file location and default
            # settings.
            log_path = os.path.join(data_dir, 'logs')
            conf = AgentConfig(config_file_path=conf_path,
                               default_log_path=log_path)

            # Init the logging
            Logger.init_logger(conf, log_level=log_level, log_to_console=True)
            # The message Parser which will encrypt (if specified) and send the
            # messages.
            parser = Core.AgentNotificationParser(conf)

            # The agent main loop
            self.agent_main_loop = Core.AgentMainLoop(parser, conf)
            self.agent_main_loop.set_data_dir(data_dir)
            self.agent_main_loop.run()
        def start(self):
            # Try to start the mongo service in case it wasn't started by Windows
            try:
                UmitService.start_service('MongoDB')
            except:
                pass
            log_path = os.path.join(data_dir, 'logs')
            conf = ServerConfig(config_file_path=conf_path,
                                default_log_path=log_path)

            # Init the logging
            Logger.init_logger(conf, log_level=log_level, log_to_console=True)

            # Load the Core based on the configs.
            self.core = ServerCore(conf)

            # Run the Core.
            self.core.run()
    if not debug_mode:
        conf_path = '/etc/umit_agent.conf'
        conf = AgentConfig(config_file_path=conf_path)
        data_dir = conf.get(InventoryConfig.general_section, 'data_dir')
    else:
        conf_path = os.path.join(CONFIG_DIR, 'umit_agent.conf')


# Launch the agent in debug mode
if debug_mode:
    conf = AgentConfig(config_file_path=conf_path)

    real_log_level = 'debug'
    if log_level is not None:
        real_log_level = log_level
    Logger.init_logger(conf, log_level=real_log_level, log_to_console=True)
    
    parser = Core.AgentNotificationParser(conf)

    # The agent main loop
    agent_main_loop = Core.AgentMainLoop(parser, conf)
    agent_main_loop.set_data_dir(data_dir)
    agent_main_loop.run()


# Run as a Windows Service
if os.name == 'nt' and not debug_mode:
    from umit.inventory.Service import UmitService

    
    class UmitAgentService(UmitService):