tensor/outputs/riemann.py
def createClient(self):
        """Create a TCP connection to Riemann with automatic reconnection
        """

        server = self.config.get('server', 'localhost')
        port = self.config.get('port', 5555)
        failover = self.config.get('failover', False)

        self.factory = riemann.RiemannClientFactory(server, failover=failover)

        if failover:
            initial = random.choice(server)
        else:
            initial = server

        log.msg('Connecting to Riemann on %s:%s' % (initial, port))
        
        if self.tls:
            if SSL:
                self.connector = reactor.connectSSL(initial, port, self.factory,
                    ClientTLSContext(self.key, self.cert))
            else:
                log.msg('[FATAL] SSL support not available!' \
                    ' Please install PyOpenSSL. Exiting now')
                reactor.stop()
        else:
            self.connector = reactor.connectTCP(initial, port, self.factory)

        d = defer.Deferred()

        def cb():
            # Wait until we have a useful proto object
            if hasattr(self.factory, 'proto') and self.factory.proto:
                self.t.start(self.inter)
                d.callback(None)
            else:
                reactor.callLater(0.01, cb)

        cb()

        return d
def createClient(self):
        """Create a TCP connection to Riemann with automatic reconnection
        """

        server = self.config.get('server', 'localhost')
        port = self.config.get('port', 5555)
        failover = self.config.get('failover', False)

        self.factory = riemann.RiemannClientFactory(server, failover=failover)

        if failover:
            initial = random.choice(server)
        else:
            initial = server

        log.msg('Connecting to Riemann on %s:%s' % (initial, port))
        
        if self.tls:
            if SSL:
                self.connector = reactor.connectSSL(initial, port, self.factory,
                    ClientTLSContext(self.key, self.cert))
            else:
                log.msg('[FATAL] SSL support not available!' \
                    ' Please install PyOpenSSL. Exiting now')
                reactor.stop()
        else:
            self.connector = reactor.connectTCP(initial, port, self.factory)

        d = defer.Deferred()

        def cb():
            # Wait until we have a useful proto object
            if hasattr(self.factory, 'proto') and self.factory.proto:
                self.t.start(self.inter)
                d.callback(None)
            else:
                reactor.callLater(0.01, cb)

        cb()

        return d
def createClient ( self ) : server = self . config . get ( 'server' , 'localhost' ) port = self . config . get ( 'port' , 5555 ) failover = self . config . get ( 'failover' , False ) self . factory = riemann . RiemannClientFactory ( server , failover = failover ) if failover : initial = random . choice ( server ) else : initial = server log . msg ( 'Connecting to Riemann on %s:%s' % ( initial , port ) ) if self . tls : if SSL : self . connector = reactor . connectSSL ( initial , port , self . factory , ClientTLSContext ( self . key , self . cert ) ) else : log . msg ( '[FATAL] SSL support not available!' ' Please install PyOpenSSL. Exiting now' ) reactor . stop ( ) else : self . connector = reactor . connectTCP ( initial , port , self . factory ) d = defer . Deferred ( ) def cb ( ) : # Wait until we have a useful proto object if hasattr ( self . factory , 'proto' ) and self . factory . proto : self . t . start ( self . inter ) d . callback ( None ) else : reactor . callLater ( 0.01 , cb ) cb ( ) return d
Create a TCP connection to Riemann with automatic reconnection
Create a TCP connection to Riemann with automatic reconnection