Beispiel #1
0
 def start_server():
     global global_server
     ioloop = tornado.ioloop.IOLoop()
     ioloop.make_current()
     global_server = Server(ioloop=ioloop, **global_server_args)
     done.set()
     ioloop.start()
     ioloop.close()
Beispiel #2
0
 def exit_gracefully(self):
     ioloop = tornado.ioloop.IOLoop.current()
     stop_all_modules()
     stop_all_schema()
     if self.database:
         ioloop.run_sync(self.database.shutdown)
     ioloop.close()
     application_log.info("Maverick API server has stopped")
Beispiel #3
0
def main(debug, static_dir, template_dir, listen):
    application = make_app(debug, static_dir, template_dir)
    application.listen(address=listen.address, port=listen.port)

    url = "http://{0}:{1}".format(listen.address, listen.port)
    print('Starting server at {0}'.format(url))

    # open a URL, if possible on new tab
    webbrowser.open(url, new=2)

    ioloop = tornado.ioloop.IOLoop.instance()
    try:
        ioloop.start()
    except KeyboardInterrupt:
        ioloop.stop()
        ioloop.close()
Beispiel #4
0
 def stop_ioloop():
     ioloop.stop()
     ioloop.close()
Beispiel #5
0
        rabbitmq_client.NagiosReceiver(
            mq_host, mq_username, mq_password, mq_virtual_host, callback=nagios_alert_handler
        )
        logger.info("Start Nagios Watcher OK.")

    # Receive alerts from XenServer
    # Connect to XenServer without timeout
    if settings.XENSERVER_HANDLE_ENABLED:
        for host in XEN:
            try:
                session = XenAPI.Session("http://" + host[0])
                session.login_with_password(host[1], host[2])
                logger.warn("Connect to XenServer: {0} are success.".format(host[0]))
            except Exception, e:
                logger.exception(e)
            else:
                t = XenServer_Alerts_Watcher(host[0], session, xenserver_event_handler)
                t.start()
                logger.warn("Start XenServer event watcher for %s." % host[0])
        logger.info("Start XenServer Watcher OK.")

    app = iApplication()
    app.listen(port, xheaders=True)
    logger.info("Start server OK.")

    try:
        ioloop = ioloop.IOLoop.instance()
        ioloop.start()
    except (KeyboardInterrupt, SystemExit):
        ioloop.close()
Beispiel #6
0
                                       callback=nagios_alert_handler)
        logger.info("Start Nagios Watcher OK.")

    # Receive alerts from XenServer
    # Connect to XenServer without timeout
    if settings.XENSERVER_HANDLE_ENABLED:
        for host in XEN:
            try:
                session = XenAPI.Session("http://" + host[0])
                session.login_with_password(host[1], host[2])
                logger.warn("Connect to XenServer: {0} are success.".format(
                    host[0]))
            except Exception, e:
                logger.exception(e)
            else:
                t = XenServer_Alerts_Watcher(host[0], session,
                                             xenserver_event_handler)
                t.start()
                logger.warn("Start XenServer event watcher for %s." % host[0])
        logger.info("Start XenServer Watcher OK.")

    app = iApplication()
    app.listen(port, xheaders=True)
    logger.info("Start server OK.")

    try:
        ioloop = ioloop.IOLoop.instance()
        ioloop.start()
    except (KeyboardInterrupt, SystemExit):
        ioloop.close()
Beispiel #7
0
 def stop_ioloop():
     ioloop.stop()
     ioloop.close()