def manage_finished_checks(self): to_del = [] # First look for checks in timeout for chk in self.checks: if chk.status == 'launched' and chk.con.state != 'received': chk.con.look_for_timeout() # Now we look for finished checks for chk in self.checks: # First manage check in error, bad formed if chk.status == 'done': to_del.append(chk) try: self.returns_queue.put(chk) except IOError, exp: logger.critical("[SnmpBooster] " "[%d]Exiting: %s" % (self.id, exp)) sys.exit(2) continue # Then we check for good checks if chk.status == 'launched' and chk.con.is_done(): con = chk.con chk.status = 'done' chk.exit_status = getattr(con, 'rc', 3) chk.get_outputs(str(getattr(con, 'message', 'Error in launching command.')), 8012) chk.execution_time = getattr(con, 'execution_time', 0.0) # unlink our object from the original check if hasattr(chk, 'con'): delattr(chk, 'con') # and set this check for deleting # and try to send it to_del.append(chk) try: self.returns_queue.put(chk) except IOError, exp: logger.critical("[SnmpBooster] " "[%d]Exiting: %s" % (self.id, exp)) sys.exit(2)
def manage_finished_checks(self): to_del = [] # First look for checks in timeout for chk in self.checks: if chk.status == 'launched' and chk.con.state != 'received': chk.con.look_for_timeout() # Now we look for finished checks for chk in self.checks: # First manage check in error, bad formed if chk.status == 'done': to_del.append(chk) try: self.returns_queue.put(chk) except IOError, exp: logger.critical("[SnmpBooster] " "[%d]Exiting: %s" % (self.id, exp)) sys.exit(2) continue # Then we check for good checks if chk.status == 'launched' and chk.con.is_done(): con = chk.con chk.status = 'done' chk.exit_status = getattr(con, 'rc', 3) chk.get_outputs( str(getattr(con, 'message', 'Error in launching command.')), 8012) chk.execution_time = getattr(con, 'execution_time', 0.0) # unlink our object from the original check if hasattr(chk, 'con'): delattr(chk, 'con') # and set this check for deleting # and try to send it to_del.append(chk) try: self.returns_queue.put(chk) except IOError, exp: logger.critical("[SnmpBooster] " "[%d]Exiting: %s" % (self.id, exp)) sys.exit(2)
def main(self): try: self.load_config_file() self.do_daemon_init_and_start() self.uri2 = self.pyro_daemon.register(self.interface, "ForArbiter") logger.info("[scheduler] General interface is at: %s" % self.uri2) self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical("You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help") logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() # Look if we are enabled or not. If ok, start the daemon mode self.look_for_early_exit() for line in self.get_header(): logger.info(line) logger.info("[Receiver] Using working directory: %s" % os.path.abspath(self.workdir)) self.do_daemon_init_and_start() self.load_modules_manager() self.uri2 = self.http_daemon.register( self.interface) #, "ForArbiter") logger.debug("The Arbiter uri it at %s" % self.uri2) self.uri3 = self.http_daemon.register(self.istats) # Register ibroks if self.ibroks is not None: logger.debug("Deconnecting previous Broks Interface") self.http_daemon.unregister(self.ibroks) # Create and connect it self.http_daemon.register(self.ibroks) # We wait for initial conf self.wait_for_initial_conf() if not self.new_conf: return self.setup_new_conf() self.modules_manager.set_modules(self.modules) self.do_load_modules() # and start external modules too self.modules_manager.start_external_instances() # Do the modules part, we have our modules in self.modules # REF: doc/receiver-modules.png (1) # Now the main loop self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical( "You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help" ) logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() # Look if we are enabled or not. If ok, start the daemon mode self.look_for_early_exit() for line in self.get_header(): logger.info(line) logger.info("[Receiver] Using working directory: %s" % os.path.abspath(self.workdir)) self.do_daemon_init_and_start() self.load_modules_manager() self.uri2 = self.http_daemon.register(self.interface)#, "ForArbiter") logger.debug("The Arbiter uri it at %s" % self.uri2) self.uri3 = self.http_daemon.register(self.istats) # Register ibroks if self.ibroks is not None: logger.debug("Deconnecting previous Broks Interface") self.http_daemon.unregister(self.ibroks) # Create and connect it self.http_daemon.register(self.ibroks) # We wait for initial conf self.wait_for_initial_conf() if not self.new_conf: return self.setup_new_conf() self.modules_manager.set_modules(self.modules) self.do_load_modules() # and start external modules too self.modules_manager.start_external_instances() # Do the modules part, we have our modules in self.modules # REF: doc/receiver-modules.png (1) # Now the main loop self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical("You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help") logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() self.look_for_early_exit() self.do_daemon_init_and_start() self.uri2 = self.pyro_daemon.register(self.interface, "ForArbiter") logger.info("[scheduler] General interface is at: %s" % self.uri2) self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical( "You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help" ) logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() for line in self.get_header(): logger.info(line) logger.info("[Broker] Using working directory: %s" % os.path.abspath(self.workdir)) # Look if we are enabled or not. If ok, start the daemon mode self.look_for_early_exit() self.do_daemon_init_and_start() self.load_modules_manager() self.uri2 = self.http_daemon.register( self.interface) #, "ForArbiter") logger.debug("The Arbiter uri it at %s" % self.uri2) # We wait for initial conf self.wait_for_initial_conf() if not self.new_conf: return self.setup_new_conf() # We already init modules during the new conf thing # Set modules, init them and start external ones #self.modules_manager.set_modules(self.modules) #self.do_load_modules() #self.modules_manager.start_external_instances() # Do the modules part, we have our modules in self.modules # REF: doc/broker-modules.png (1) self.hook_point('load_retention') # Now the main loop self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical( "You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help" ) logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() for line in self.get_header(): logger.info(line) logger.info("[Broker] Using working directory: %s" % os.path.abspath(self.workdir)) # Look if we are enabled or not. If ok, start the daemon mode self.look_for_early_exit() self.do_daemon_init_and_start() self.load_modules_manager() self.uri2 = self.http_daemon.register(self.interface)#, "ForArbiter") logger.debug("The Arbiter uri it at %s" % self.uri2) # We wait for initial conf self.wait_for_initial_conf() if not self.new_conf: return self.setup_new_conf() # We already init modules during the new conf thing # Set modules, init them and start external ones #self.modules_manager.set_modules(self.modules) #self.do_load_modules() #self.modules_manager.start_external_instances() # Do the modules part, we have our modules in self.modules # REF: doc/broker-modules.png (1) self.hook_point('load_retention') # Now the main loop self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical("You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help") logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise
def main(self): try: self.load_config_file() self.look_for_early_exit() self.do_daemon_init_and_start() self.load_modules_manager() self.http_daemon.register(self.interface) #self.inject = Injector(self.sched) #self.http_daemon.register(self.inject) self.http_daemon.unregister(self.interface) self.uri = self.http_daemon.uri logger.info("[scheduler] General interface is at: %s" % self.uri) self.do_mainloop() except Exception, exp: logger.critical("I got an unrecoverable error. I have to exit") logger.critical("You can log a bug ticket at https://github.com/naparuba/shinken/issues/new to get help") logger.critical("Back trace of it: %s" % (traceback.format_exc())) raise