Beispiel #1
0
        services.read_services()
        config.read_config()
        users.read_users()
        if (str(SECRET_KEY) == 'PutSomethingRandomHere'):
            logger.error(
                "You need to change the SECRET_KEY in configuration/webgui.env"
            )
            raise Exception("Invalid or missing SECRET_KEY in webgui.env")
    except Exception as e:
        logger.error(e)
        logger.error("Cannot start service. Showing emergency message.")
        launch_emergency_app()
        logger.info("Going down.")
        sys.exit(1)

    monitor.configure('webgui', 'main', config.mercure['bookkeeper'])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f'PID = {os.getpid()}')

    try:
        tagslist.read_tagslist()
    except Exception as e:
        logger.info(e)
        logger.info(
            "Unable to parse tag list. Rule evaluation will not be available.")

    uvicorn.run(app, host=WEBGUI_HOST, port=WEBGUI_PORT)

    # Process will exit here
    monitor.send_event(monitor.h_events.SHUTDOWN, monitor.severity.INFO, '')
Beispiel #2
0
    # Read the configuration file and terminate if it cannot be read
    try:
        config.read_config()
    except Exception:
        logger.exception("Cannot start service. Going down.")
        sys.exit(1)

    appliance_name = config.mercure['appliance_name']

    logger.info(f'Appliance name = {appliance_name}')
    logger.info(f'Instance  name = {instance_name}')
    logger.info(f'Instance  PID  = {os.getpid()}')
    logger.info(sys.version)

    monitor.configure('processor', instance_name, config.mercure['bookkeeper'])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f'PID = {os.getpid()}')

    if len(config.mercure['graphite_ip']) > 0:
        logger.info(
            f'Sending events to graphite server: {config.mercure["graphite_ip"]}'
        )
        graphite_prefix = 'mercure.' + appliance_name + '.processor.' + instance_name
        graphyte.init(config.mercure['graphite_ip'],
                      config.mercure['graphite_port'],
                      prefix=graphite_prefix)

    logger.info(f'Processing folder: {config.mercure["processing_folder"]}')
    processor_lockfile = Path(config.mercure['processing_folder'] + '/HALT')
Beispiel #3
0
        instance_name = sys.argv[1]

    try:
        config.read_config()
    except Exception:
        logger.exception("Cannot start service. Going down.")
        sys.exit(1)

    appliance_name = config.mercure["appliance_name"]

    logger.info(f"Appliance name = {appliance_name}")
    logger.info(f"Instance  name = {instance_name}")
    logger.info(f"Instance  PID  = {os.getpid()}")
    logger.info(sys.version)

    monitor.configure("dispatcher", instance_name, config.mercure["bookkeeper"])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO, f"PID = {os.getpid()}")

    if len(config.mercure["graphite_ip"]) > 0:
        logging.info(f'Sending events to graphite server: {config.mercure["graphite_ip"]}')
        graphite_prefix = "mercure." + appliance_name + ".dispatcher." + instance_name
        graphyte.init(
            config.mercure["graphite_ip"],
            config.mercure["graphite_port"],
            prefix=graphite_prefix,
        )

    logger.info(f"Dispatching folder: {config.mercure[mercure_folders.OUTGOING]}")

    global main_loop
    main_loop = helper.RepeatedTimer(config.mercure["dispatcher_scan_interval"], dispatch, exit_dispatcher, {})
Beispiel #4
0
        instance_name = sys.argv[1]

    try:
        config.read_config()
    except Exception:
        logger.exception("Cannot start service. Going down.")
        sys.exit(1)

    appliance_name = config.mercure['appliance_name']

    logger.info(f'Appliance name = {appliance_name}')
    logger.info(f"Instance  name = {instance_name}")
    logger.info(f"Instance  PID  = {os.getpid()}")
    logger.info(sys.version)

    monitor.configure("cleaner", instance_name, config.mercure["bookkeeper"])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f"PID = {os.getpid()}")

    if len(config.mercure["graphite_ip"]) > 0:
        logger.info(
            f"Sending events to graphite server: {config.mercure['graphite_ip']}"
        )
        graphite_prefix = "mercure." + appliance_name + ".cleaner." + instance_name
        graphyte.init(
            config.mercure["graphite_ip"],
            config.mercure["graphite_port"],
            prefix=graphite_prefix,
        )

    global main_loop
Beispiel #5
0
        services.read_services()
        config.read_config()
        users.read_users()
        if str(SECRET_KEY) == "PutSomethingRandomHere":
            logger.error(
                "You need to change the SECRET_KEY in configuration/webgui.env"
            )
            raise Exception("Invalid or missing SECRET_KEY in webgui.env")
    except Exception as e:
        logger.error(e)
        logger.error("Cannot start service. Showing emergency message.")
        launch_emergency_app()
        logger.info("Going down.")
        sys.exit(1)

    monitor.configure("webgui", "main", config.mercure["bookkeeper"])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f"PID = {os.getpid()}")

    try:
        tagslist.read_tagslist()
    except Exception as e:
        logger.info(e)
        logger.info(
            "Unable to parse tag list. Rule evaluation will not be available.")

    uvicorn.run(app, host=WEBGUI_HOST, port=WEBGUI_PORT)

    # Process will exit here
    monitor.send_event(monitor.h_events.SHUTDOWN, monitor.severity.INFO, "")
Beispiel #6
0
    # Read the configuration file and terminate if it cannot be read
    try:
        config.read_config()
    except Exception:
        logger.exception("Cannot start service. Going down.")
        sys.exit(1)

    appliance_name = config.mercure['appliance_name']

    logger.info(f'Appliance name = {appliance_name}')
    logger.info(f'Instance  name = {instance_name}')
    logger.info(f'Instance  PID  = {os.getpid()}')
    logger.info(sys.version)

    monitor.configure('router', instance_name, config.mercure['bookkeeper'])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f'PID = {os.getpid()}')

    if len(config.mercure['graphite_ip']) > 0:
        logger.info(
            f'Sending events to graphite server: {config.mercure["graphite_ip"]}'
        )
        graphite_prefix = 'mercure.' + appliance_name + '.router.' + instance_name
        graphyte.init(config.mercure['graphite_ip'],
                      config.mercure['graphite_port'],
                      prefix=graphite_prefix)

    logger.info(f'Incoming   folder: {config.mercure["incoming_folder"]}')
    logger.info(f'Studies    folder: {config.mercure["studies_folder"]}')
    logger.info(f'Outgoing   folder: {config.mercure["outgoing_folder"]}')
Beispiel #7
0
    # Read the configuration file and terminate if it cannot be read
    try:
        config.read_config()
    except Exception:
        logger.exception("Cannot start service. Going down.")
        sys.exit(1)

    appliance_name = config.mercure["appliance_name"]

    logger.info(f"Appliance name = {appliance_name}")
    logger.info(f"Instance  name = {instance_name}")
    logger.info(f"Instance  PID  = {os.getpid()}")
    logger.info(sys.version)

    monitor.configure("processor", instance_name, config.mercure["bookkeeper"])
    monitor.send_event(monitor.h_events.BOOT, monitor.severity.INFO,
                       f"PID = {os.getpid()}")

    if len(config.mercure["graphite_ip"]) > 0:
        logger.info(
            f'Sending events to graphite server: {config.mercure["graphite_ip"]}'
        )
        graphite_prefix = "mercure." + appliance_name + ".processor." + instance_name
        graphyte.init(config.mercure["graphite_ip"],
                      config.mercure["graphite_port"],
                      prefix=graphite_prefix)

    logger.info(f'Processing folder: {config.mercure["processing_folder"]}')
    processor_lockfile = Path(config.mercure["processing_folder"] + "/HALT")