Example #1
0
        ds_class = util.import_module_class(ds)
        ds_kwargs = config['data_server']['data_source_config'].get(ds, {})
        ds_instance = ds_class(
            **ds_kwargs)  # args only used by StatMonsterRRD atm
        key = hashlib.sha1(ds).hexdigest()[:6]
        ds_instance._FF_KEY = key
        config['data_server']['data_sources_by_key'][key] = ds_instance
        return ds_instance

    for ds in config['data_server']['data_sources']:
        ds_instance = get_ds_instance(ds)
        data_sources.append(ds_instance)
        log.debug('Using datasource %s' % type(ds_instance).__name__)

    config["data_server"]["data_sources"] = data_sources

    if not options.omit_data_server:
        # Allow the data server to initialize itself and attach itself to the IOLoop
        initialize_data_server(config["data_server"],
                               secret_key=config["secret_key"],
                               ioloop=tornado.ioloop.IOLoop.instance())

    if not options.omit_ui_server:
        # Allow the UI server to initialize itself and attach itself to the IOLoop
        initialize_ui_server(config["ui_server"],
                             secret_key=config["secret_key"],
                             ioloop=tornado.ioloop.IOLoop.instance())

    # Kick everything off
    tornado.ioloop.IOLoop.instance().start()
Example #2
0
    for ds in config['data_server']['data_sources']:
        ds_instance = get_ds_instance(ds)
        data_sources.append(ds_instance)
        log.debug('Using datasource %s' % type(ds_instance).__name__)

    config["data_server"]["data_sources"] = data_sources

    if "secret_key" not in config.keys():
        log.error("No Secret Key Provided: Exiting")
        sys.exit(1)

    if not options.omit_data_server:
        # Allow the data server to initialize itself and attach itself to the IOLoop
        try:
            initialize_data_server(config, secret_key=config["secret_key"])
        except socket.error as exc:
            log.error('Problem starting data server: %s' % str(exc))
            sys.exit(1)

    if not options.omit_ui_server:
        # Allow the UI server to initialize itself and attach itself to the IOLoop
        try:
            initialize_ui_server(config, secret_key=config["secret_key"])
        except socket.error as exc:
            # The following hack is unfortunate, but necessary.
            # When Tornado forks, its does the right thing when an HTTP server
            # is configured to have as many workers as procs that gets forked.
            # However, if another HTTPServer is on the IOLoop, it will fail to
            # bind to the right address somewhere in the process.
            # This is OK, because the predecessor procs will live on and serve
Example #3
0
    for ds in config['data_server']['data_sources']:
        ds_instance = get_ds_instance(ds)
        data_sources.append(ds_instance)
        log.debug('Using datasource %s' % type(ds_instance).__name__)

    config["data_server"]["data_sources"] = data_sources

    if "secret_key" not in config.keys():
        log.error("No Secret Key Provided: Exiting")
        sys.exit(1)

    if not options.omit_data_server:
        # Allow the data server to initialize itself and attach itself to the IOLoop
        try:
            initialize_data_server(config["data_server"], secret_key=config["secret_key"])
        except socket.error as exc:
            log.error('Problem starting data server: %s' % str(exc))
            sys.exit(1)

    if not options.omit_ui_server:
        # Allow the UI server to initialize itself and attach itself to the IOLoop
        try:
            initialize_ui_server(config["ui_server"], secret_key=config["secret_key"])
        except socket.error as exc:
            # The following hack is unfortunate, but necessary.
            # When Tornado forks, its does the right thing when an HTTP server
            # is configured to have as many workers as procs that gets forked.
            # However, if another HTTPServer is on the IOLoop, it will fail to
            # bind to the right address somewhere in the process.
            # This is OK, because the predecessor procs will live on and serve
Example #4
0
    data_sources = []

    # mix in the configured data sources to the data server configuration
    def get_ds_instance(ds):
        ds_class = util.import_module_class(ds)
        ds_kwargs = config['data_server']['data_source_config'].get(ds, {})
        ds_instance = ds_class(**ds_kwargs) # args only used by StatMonsterRRD atm
        key = hashlib.sha1(ds).hexdigest()[:6]
        ds_instance._FF_KEY = key
        config['data_server']['data_sources_by_key'][key] = ds_instance
        return ds_instance

    for ds in config['data_server']['data_sources']:
        ds_instance = get_ds_instance(ds)
        data_sources.append(ds_instance)
        log.debug('Using datasource %s' % type(ds_instance).__name__)

    config["data_server"]["data_sources"] = data_sources

    if not options.omit_data_server:
        # Allow the data server to initialize itself and attach itself to the IOLoop
        initialize_data_server(config["data_server"], secret_key=config["secret_key"], ioloop=tornado.ioloop.IOLoop.instance())

    if not options.omit_ui_server:
        # Allow the UI server to initialize itself and attach itself to the IOLoop
        initialize_ui_server(config["ui_server"], secret_key=config["secret_key"], ioloop=tornado.ioloop.IOLoop.instance())

    # Kick everything off
    tornado.ioloop.IOLoop.instance().start()