def stopMonitorThreads(config): monitors = cfg.getMonitors(config) for key in monitors: monitorConfig = cfg.loadMonitorConfig(config, key) monitorThread = thutil.getThread(cfg.THREAD_MONITOR + monitorConfig.key) if monitorThread: monitorThread.stopRun()
def startMonitorsThreads(config): """ =========================================================================== Summary =========================================================================== **Args**: arg1 **Returns**: None """ monitors = cfg.getMonitors(config) for key in monitors: monitorConfig = cfg.loadMonitorConfig(config, key) monitorThread = thutil.getThread(cfg.THREAD_MONITOR+monitorConfig.key) if monitorThread: logger.debug("Thread already running:"+monitorConfig.key) continue if monitorConfig.enable: if monitorConfig.type == cfg.MONITOR_TYPE_HOST: monitorThread = monhost.MonitorHostThread(monitorConfig, th.OperationMode.NORMAL) monitorThread.start() elif monitorConfig.type == cfg.MONITOR_TYPE_SPRINGMICROSERVICE: monitorThread = monmicroserv.MonitorMicroserviceThread(monitorConfig, th.OperationMode.NORMAL) monitorThread.start() elif monitorConfig.type == cfg.MONITOR_TYPE_TOMCAT: monitorThread = montomcat.MonitorTomcatThread(monitorConfig, th.OperationMode.NORMAL) monitorThread.start() elif monitorConfig.type == cfg.MONITOR_TYPE_POSTGRES: monitorThread = monpsql.MonitorPostgresThread(monitorConfig, th.OperationMode.NORMAL) monitorThread.start() else: logger.error("Invalid monitor type :"+str(monitorConfig.type))
def startReadersThreads(config): """ =========================================================================== Summary =========================================================================== **Args**: arg1 **Returns**: None """ # Start Readers Threads readers = cfg.getReaders(config) for key in readers: readerConfig = cfg.loadReaderConfig(config, key) readerThread = thutil.getThread(cfg.THREAD_READER+readerConfig.key) if readerThread: logger.debug("Thread already running:"+readerConfig.key) continue if readerConfig.enable: readerThread = reader.ReaderThread(readerConfig, th.OperationMode.NORMAL) readerThread.start()
def stopMapperThreads(config): readers = cfg.getReaders(config) for readerName in readers: readerConfig = cfg.loadReaderConfig(config, readerName) mapperThread = thutil.getThread(cfg.THREAD_MAPPER + readerConfig.key) if mapperThread: mapperThread.stopRun()
def stopReaderThreads(config): readers = cfg.getReaders(config) for readerName in readers: readerConfig = cfg.loadReaderConfig(config, readerName) readerThread = thutil.getThread(cfg.THREAD_READER + readerConfig.key) if readerThread: readerThread.stopRun()
def stopReader(key): readerThread = thutil.getThread(cfg.THREAD_READER + key) if readerThread: readerThread.stopRun()
def setMonitorThreads(config, cmd, value): monitors = cfg.getMonitors(config) for key in monitors: monitorConfig = cfg.loadMonitorConfig(config, key) monitorThread = thutil.getThread(cfg.THREAD_MONITOR+monitorConfig.key) applyOptionInThread(monitorThread, cmd, value)
def setReaderThreads(config, cmd, value): readers = cfg.getReaders(config) for readerName in readers: readerConfig = cfg.loadReaderConfig(config, readerName) readerThread = thutil.getThread(cfg.THREAD_READER+readerConfig.key) applyOptionInThread(readerThread, cmd, value)