コード例 #1
0
def main():
    # Set up logging
    getRootLogger(options.level, options.syslog)
    logging.getLogger('nd_service_registry.shims').setLevel(logging.WARNING)

    # Prep the config objects required to start up our web service
    paths = getPathList(options.file)
    sr = nd_service_registry.KazooServiceRegistry(server=options.zookeeper,
                                                  readonly=False,
                                                  timeout=1,
                                                  lazy=True)

    # Load up our cluster configuration state engine. This object provides
    # access to a store cluster-wide configuration settings and state
    # within Zookeeper itself.
    workspace = '%s/%s' % (options.cluster_prefix, options.cluster_name)
    cs = cluster.State(sr, workspace)

    # May instantiate this here instead of inside of Monitor
    dis = dispatcher.Dispatcher(cluster_state=cs, config=paths)

    # Kick off our main monitoring object
    mon = monitor.Monitor(dis, sr, cs, paths)

    # Build the HTTP service listening to the port supplied
    server = app.getApplication(sr, mon, dis)
    server.listen(int(options.port))
    ioloop.IOLoop.instance().start()
コード例 #2
0
ファイル: runserver.py プロジェクト: Nextdoor/zkmonitor
def main():
    # Set up logging
    getRootLogger(options.level, options.syslog)
    logging.getLogger('nd_service_registry.shims').setLevel(logging.WARNING)

    log.info('Connecting to zookeeper via \'%s\'' % options.zookeeper)
    # Prep the config objects required to start up our web service
    sr = nd_service_registry.KazooServiceRegistry(
        server=options.zookeeper,
        readonly=False,
        timeout=1,
        lazy=True)

    # Load up our cluster configuration state engine. This object provides
    # access to a store cluster-wide configuration settings and state
    # within Zookeeper itself.
    workspace = '%s/%s' % (options.cluster_prefix, options.cluster_name)
    cs = cluster.State(sr, workspace)

    log.info('Parsing paths to watch from \'%s\'' % options.file)
    paths = getPathList(options.file)
    # May instantiate this here instead of inside of Monitor
    dis = dispatcher.Dispatcher(
        cluster_state=cs,
        config=paths)

    # Kick off our main monitoring object
    mon = monitor.Monitor(dis, sr, cs, paths)

    # Build the HTTP service listening to the port supplied
    server = app.getApplication(sr, mon, dis)
    server.listen(int(options.port))
    ioloop.IOLoop.instance().start()
コード例 #3
0
 def get_app(self):
     return app.getApplication(None, None, None)
コード例 #4
0
ファイル: test_app.py プロジェクト: Nextdoor/zkmonitor
 def get_app(self):
     run = app.getApplication(None, None, None)
     return run