def shutdown(signum = None, frame = None): with stopLock: global stopped if stopped: return else: stopped = True logging.getLogger().info("Shutting down probe") Scheduler.quit() if Params.COMMANDER and commander is not None: commander.quit() from calls.actions import Quit if Params.WATCHERS: WatcherManager.stopWatchers() from managers.probetests import TestManager, TestResponder TestManager.stopTests() TestResponder.stopTests() if actionMan is not None: ActionMan.addTask(Quit()) if server is not None: server.quit() if actionMan is not None: actionMan.quit() #everybody might need the client so stop it last if client is not None: client.quit()
def shutdown(signum=None, frame=None): with stopLock: global stopped if stopped: return else: stopped = True logging.getLogger().info("Shutting down probe") Scheduler.quit() if Params.COMMANDER and commander is not None: commander.quit() from calls.actions import Quit if Params.WATCHERS: WatcherManager.stopWatchers() from managers.probetests import TestManager, TestResponder TestManager.stopTests() TestResponder.stopTests() if actionMan is not None: ActionMan.addTask(Quit()) if server is not None: server.quit() if actionMan is not None: actionMan.quit() #everybody might need the client so stop it last if client is not None: client.quit()
server = Server() server.start() server.isUp.wait() actionMan = ActionMan() actionMan.start() if Params.COMMANDER: commander = CommanderServer() commander.start() if Params.WATCHERS: wd = os.path.join(DATA_DIR, WATCHERS_OUTPUT_DIR) if not os.path.exists(wd): os.mkdir(wd) WatcherManager.setOutputDir(wd) for watcher in args.watchers: parts = watcher.partition('=') try: WatcherManager.registerWatcher(parts[0], parts[2], wlogger) except WatcherError as e: logging.getLogger().warning("Starting watcher failed : %s", e, exc_info = 1) # ProbeStorage.addProbe( Probe("id", "10.0.0.1" ) ) client = Client() client.start() client.isUp.wait() logging.getLogger().info("Startup Done") for prefix in args.add_prefix: logging.getLogger().info("Adding probes in prefix %s", prefix)
server = Server() server.start() server.isUp.wait() actionMan = ActionMan() actionMan.start() if Params.COMMANDER: commander = CommanderServer() commander.start() if Params.WATCHERS: wd = os.path.join(DATA_DIR, WATCHERS_OUTPUT_DIR) if not os.path.exists(wd): os.mkdir(wd) WatcherManager.setOutputDir(wd) for watcher in args.watchers: parts = watcher.partition('=') try: WatcherManager.registerWatcher(parts[0], parts[2], wlogger) except WatcherError as e: logging.getLogger().warning("Starting watcher failed : %s", e, exc_info=1) # ProbeStorage.addProbe( Probe("id", "10.0.0.1" ) ) client = Client() client.start() client.isUp.wait() logging.getLogger().info("Startup Done")
def treatWatcherMessage(cls, message): """Treats a watcher message which is intended for one watcher instance""" assert isinstance(message, WatcherMessage) WatcherManager.handleMessage(message)