def _setUpSettings(self): try: self._settings = ConfigurationManager() except Exception as e: print("RaspLed system error:") print(" Could not load configuration file RaspLed.ini " + str(e)) print(" Contact system support.") sys.exit()
def work(self): ''' Вызываемый по таймеру метод ''' currentTime = TimeManager.getTime() deleteInterval = ConfigurationManager.sessionDeleteInterval() time = currentTime + deleteInterval Session.objects.filter(referenceTime__lt = time).delete() self.test = self.test + 1
confBox.getKafkaServerPort(), confBox.getKafkaServerTopic()) kafkaClient.start() if confBox.getTcpServerAddress() != "" and confBox.getTcpServerPort( ) != 0: tcpServer = TcpServer( confBox.getTcpServerAddress(), \ confBox.getTcpServerPort() ) tcpServer.start() except Exception as e: logger.error(e) if kafkaClient != None: kafkaClient.stop() if tcpServer != None: tcpServer.stop() sys.exit(1) if kafkaClient != None: kafkaClient.join() if tcpServer != None: tcpServer.join() if __name__ == "__main__": confBox = ConfigurationManager() myLogger = MyLogger() logger = myLogger.getLogger(logName=__name__) logger.debug("starting ... ") main() logger.debug("... end ")
endTime = int(time.time()) startTime = endTime - rrdConstants.TIME_FRAME startTime, endTime = str(startTime), str(endTime) print('Generando reporte...') pdfMaker = SnmpReportGenerator(agentInfo) pdfMaker.makeReport(filename, startTime, endTime) elif option == 5: # Generate configuration file. agent = selectAgent(monitorGroup.getAgentList()) if not agent: continue manager = ConfigurationManager(agent) if manager.dumpConfiguration(): print('El archivo de configuración fue creado en el agente.') else: print('No se pudo crear el archivo de configuración.') continue elif option == 6: # Retrieve configuration file. agent = selectAgent(monitorGroup.getAgentList()) if not agent: continue manager = ConfigurationManager(agent)
def __init__(): ''' Конструктор.Запускает очистку сессий. ''' SessionManager.checkSessionWorker.doWork(ConfigurationManager.loopDeleteSessionInterval())