def __init__(self, pQueue): self.logger = IkLogger("ik_ndoutils:NdoThread") self.logger.log.info("IKOMtrol NDO Thread (Rev.: %s)" % \ getVersRevision(\ "$LastChangedRevision$") ) self._stopevent = threading.Event() self._sleepperiod = 1.0 #self.ndo_socket = socket(AF_UNIX, SOCK_STREAM) #self.ndo_socket.setblocking(0) #self.ndo_socket.bind('/opt/nagios/var/ndo.sock') self.tcpserver = IkNdoServer(('localhost', 15678), MyHandler, pQueue, self.logger) threading.Thread.__init__(self, name="NdoThread")
def __call__(self, worker_method): print "NdoMain.__call__" global _pQueue global _ndoThread main_logger = IkLogger("ndoutils") main_logger.log.info("Nagios ndoutils Connector (Rev.: %s)" % \ getVersRevision(self.__versRevision) ) if _pQueue is None: main_logger.log.debug("create Queue") _pQueue = IkQueue(maxsize=1000) if _ndoThread is None: _ndoThread = NdoThread(_pQueue) _ndoThread.setDaemon(True) _ndoThread.start() return gocept.runner.appmain.__call__(self, worker_method)
def __init__(self, pQueue): self.logger = IkLogger("ik_ndoutils:IkTransfThread") self.logger.log.info("IKOMtrol NDO-XML-RPC Thread (Rev.: %s)" % \ getVersRevision(\ "$LastChangedRevision$") ) self._stopevent = threading.Event() self._sleepperiod = 1.0 self.pQueue = pQueue self.username = '******' self.password = '******' #self.url = 'http://localhost:8080/++etc++site/default/IkAdmUtilGeneratorNagios' self.url = "http://localhost:8080/++etc++site/default/AdmUtilGeneratorNagios" self.host = xmlrpclib.Server(self.url, transport = \ BasicAuthTransport(self.username, self.password)) threading.Thread.__init__(self, name="IkTransfThread")
# zope imports # ict_ok.org imports from org.ict_ok.libs.iklogger import IkLogger from org.ict_ok.libs.ikqueue import IkQueue from org.ict_ok.version import getVersRevision from org.ict_ok.agents.ndoutils.ndo_thread import NdoThread from org.ict_ok.agents.ndoutils.xmlrpc_thread import XmlRpcThread if __name__ == "__main__": pidFile = open("/var/run/ndoutils.pid", "w") pidFile.write(str(os.getpid())) pidFile.close() main_logger = IkLogger("ndoutils") main_logger.log.info("Nagios ndoutils Connector (Rev.: %s)" % \ getVersRevision(__versRevision) ) main_logger.log.debug("create Queue") pQueue = IkQueue(maxsize=1000) ndoThread = NdoThread(pQueue) ndoThread.setDaemon(True) ndoThread.start() transThread = XmlRpcThread(pQueue) transThread.setDaemon(True) transThread.start() while 1: try: time.sleep(600) main_logger.log.debug("600 sec trigger")