def main(self):
        """Main arbiter function::

        * Set logger
        * Init daemon
        * Launch modules
        * Endless main process loop

        :return: None
        """
        try:
            # Start the daemon
            if not self.verify_only and not self.do_daemon_init_and_start():
                self.exit_on_error(message="Daemon initialization error", exit_code=3)

            if self.verify_only:
                self.setup_alignak_logger()

            # Load monitoring configuration files
            self.load_monitoring_config_file()

            # Set my own process title
            self.set_proctitle(self.name)

            # Now we can start our "external" modules (if any):
            self.modules_manager.start_external_instances()

            # Now we can load the retention data
            self.hook_point('load_retention')

            # And go for the main loop
            while True:
                self.do_main_loop()
                logger.info("Exited from the main loop.")

                # Exiting the main loop because of a configuration reload
                if not self.need_config_reload:
                    # If no configuration reload is required, stop the arbiter daemon
                    self.request_stop()
                else:
                    # Loop if a configuration reload is raised while
                    # still reloading the configuration
                    while self.need_config_reload:
                        # Clear the former configuration
                        self.need_config_reload = False
                        self.link_to_myself = None
                        self.conf = Config()
                        # Load monitoring configuration files
                        _ts = time.time()
                        logger.warning('--- Reloading configuration...')
                        self.load_monitoring_config_file()
                        duration = int(time.time() - _ts)
                        self.add(make_monitoring_log('info', 'CONFIGURATION RELOAD;%d' % duration))
                        logger.warning('--- Configuration reloaded, %d seconds', duration)

                        # Make a pause to let our satellites get ready...
                        pause = max(1, self.conf.daemons_new_conf_timeout)
                        if pause:
                            logger.info("Pausing %.2f seconds...", pause)
                            time.sleep(pause)

        except Exception as exp:  # pragma: no cover, this should never happen indeed ;)
            # Only a master arbiter can stop the daemons
            if self.is_master:
                # Stop the daemons
                self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
            self.exit_on_exception(raised_exception=exp)
            raise
def main ( self ) : try : if not self . verify_only and not self . do_daemon_init_and_start ( ) : self . exit_on_error ( message = "Daemon initialization error" , exit_code = 3 ) if self . verify_only : self . setup_alignak_logger ( ) self . load_monitoring_config_file ( ) self . set_proctitle ( self . name ) self . modules_manager . start_external_instances ( ) self . hook_point ( 'load_retention' ) while True : self . do_main_loop ( ) logger . info ( "Exited from the main loop." ) if not self . need_config_reload : self . request_stop ( ) else : while self . need_config_reload : self . need_config_reload = False self . link_to_myself = None self . conf = Config ( ) _ts = time . time ( ) logger . warning ( '--- Reloading configuration...' ) self . load_monitoring_config_file ( ) duration = int ( time . time ( ) - _ts ) self . add ( make_monitoring_log ( 'info' , 'CONFIGURATION RELOAD;%d' % duration ) ) logger . warning ( '--- Configuration reloaded, %d seconds' , duration ) pause = max ( 1 , self . conf . daemons_new_conf_timeout ) if pause : logger . info ( "Pausing %.2f seconds..." , pause ) time . sleep ( pause ) except Exception as exp : if self . is_master : self . daemons_stop ( timeout = self . conf . daemons_stop_timeout ) self . exit_on_exception ( raised_exception = exp ) raise
Main arbiter function::

        * Set logger
        * Init daemon
        * Launch modules
        * Endless main process loop

        :return: None