Exemplo n.º 1
0
def start():
    """Starts Kwapi RRD."""
    cfg.CONF(sys.argv[1:],
             project='kwapi',
             default_config_files=['/etc/kwapi/rrd.conf'])
    log.setup(cfg.CONF.log_file)
    if cfg.CONF.visualization:
        root = make_app()
        root.run(host='0.0.0.0', port=cfg.CONF.rrd_port)
    else:
        thread.start_new_thread(listen, (rrd.update_rrd,))
        rrd.create_dirs()
        signal.signal(signal.SIGINT, signal_handler)
        signal.pause()
Exemplo n.º 2
0
Arquivo: app.py Projeto: Farrael/kwapi
def make_app():
    """Instantiates Flask app, attaches collector database. """
    LOG.info('Starting RRD')
    app = flask.Flask(__name__)
    app.register_blueprint(v1.blueprint)

    thread.start_new_thread(listen, (rrd.update_rrd,))
    rrd.create_dirs()

    @app.before_request
    def attach_config():
        flask.request.probes = rrd.probes
        flask.request.scales = rrd.scales
    return app
Exemplo n.º 3
0
Arquivo: app.py Projeto: nW-fr/kwapi
def make_app():
    """Instantiates Flask app, attaches collector database. """
    LOG.info('Starting RRD')
    app = flask.Flask(__name__)
    app.register_blueprint(v1.blueprint)

    thread.start_new_thread(listen, (rrd.update_rrd, ))
    rrd.create_dirs()

    @app.before_request
    def attach_config():
        flask.request.probes = rrd.probes
        flask.request.scales = rrd.scales

    return app
Exemplo n.º 4
0
def make_app():
    """Instantiates Flask app, attaches collector database. """
    LOG.info('Starting RRD')
    app = flask.Flask(__name__)
    app.wsgi_app = ReverseProxied(app.wsgi_app)
    app.register_blueprint(v1.blueprint)

    thread.start_new_thread(listen, (rrd.update_rrd,))
    rrd.create_dirs()

    hostname = socket.getfqdn().split('.')
    hostname = hostname[1] if len(hostname) >= 2 else hostname[0]

    @app.before_request
    def attach_config():
        flask.request.hostname = hostname
        flask.request.probes = rrd.probes_set
        flask.request.scales = rrd.scales
    return app