Exemplo n.º 1
0
  def __init__(self, initializer_module):
    threading.Thread.__init__(self)
    self.heartbeat_interval = HEARTBEAT_INTERVAL
    self.stop_event = initializer_module.stop_event

    self.registration_builder = Register(initializer_module.config)

    self.initializer_module = initializer_module
    self.config = initializer_module.config

    # listeners
    self.server_responses_listener = ServerResponsesListener()
    self.commands_events_listener = CommandsEventListener(initializer_module.action_queue)
    self.metadata_events_listener = MetadataEventListener(initializer_module.metadata_cache)
    self.topology_events_listener = TopologyEventListener(initializer_module.topology_cache)
    self.configuration_events_listener = ConfigurationEventListener(initializer_module.configurations_cache)
    self.host_level_params_events_listener = HostLevelParamsEventListener(initializer_module.host_level_params_cache, initializer_module.recovery_manager)
    self.alert_definitions_events_listener = AlertDefinitionsEventListener(initializer_module.alert_definitions_cache, initializer_module.alert_scheduler_handler)
    self.agent_actions_events_listener = AgentActionsListener(initializer_module)
    self.listeners = [self.server_responses_listener, self.commands_events_listener, self.metadata_events_listener, self.topology_events_listener, self.configuration_events_listener, self.host_level_params_events_listener, self.alert_definitions_events_listener, self.agent_actions_events_listener]

    self.post_registration_requests = [
    (Constants.TOPOLOGY_REQUEST_ENDPOINT, initializer_module.topology_cache, self.topology_events_listener, Constants.TOPOLOGIES_TOPIC),
    (Constants.METADATA_REQUEST_ENDPOINT, initializer_module.metadata_cache, self.metadata_events_listener, Constants.METADATA_TOPIC),
    (Constants.CONFIGURATIONS_REQUEST_ENDPOINT, initializer_module.configurations_cache, self.configuration_events_listener, Constants.CONFIGURATIONS_TOPIC),
    (Constants.HOST_LEVEL_PARAMS_TOPIC_ENPOINT, initializer_module.host_level_params_cache, self.host_level_params_events_listener, Constants.HOST_LEVEL_PARAMS_TOPIC),
    (Constants.ALERTS_DEFINITIONS_REQUEST_ENDPOINT, initializer_module.alert_definitions_cache, self.alert_definitions_events_listener, Constants.ALERTS_DEFINITIONS_TOPIC)
    ]
    self.responseId = 0
    self.file_cache = initializer_module.file_cache
    self.stale_alerts_monitor = initializer_module.stale_alerts_monitor
Exemplo n.º 2
0
    def __init__(self, initializer_module):
        threading.Thread.__init__(self)
        self.heartbeat_interval = HEARTBEAT_INTERVAL
        self.stop_event = initializer_module.stop_event

        self.registration_builder = Register(initializer_module.config)

        self.initializer_module = initializer_module
        self.config = initializer_module.config

        # listeners
        self.server_responses_listener = initializer_module.server_responses_listener
        self.commands_events_listener = CommandsEventListener(
            initializer_module)
        self.metadata_events_listener = MetadataEventListener(
            initializer_module)
        self.topology_events_listener = TopologyEventListener(
            initializer_module)
        self.configuration_events_listener = ConfigurationEventListener(
            initializer_module)
        self.encryption_key_events_listener = EncryptionKeyListener(
            initializer_module)
        self.host_level_params_events_listener = HostLevelParamsEventListener(
            initializer_module)
        self.alert_definitions_events_listener = AlertDefinitionsEventListener(
            initializer_module)
        self.agent_actions_events_listener = AgentActionsListener(
            initializer_module)
        self.component_status_executor = initializer_module.component_status_executor
        self.listeners = [
            self.server_responses_listener, self.commands_events_listener,
            self.metadata_events_listener, self.topology_events_listener,
            self.configuration_events_listener,
            self.host_level_params_events_listener,
            self.alert_definitions_events_listener,
            self.agent_actions_events_listener,
            self.encryption_key_events_listener
        ]

        self.post_registration_requests = [
            (Constants.TOPOLOGY_REQUEST_ENDPOINT,
             initializer_module.topology_cache, self.topology_events_listener,
             Constants.TOPOLOGIES_TOPIC),
            (Constants.METADATA_REQUEST_ENDPOINT,
             initializer_module.metadata_cache, self.metadata_events_listener,
             Constants.METADATA_TOPIC),
            (Constants.CONFIGURATIONS_REQUEST_ENDPOINT,
             initializer_module.configurations_cache,
             self.configuration_events_listener,
             Constants.CONFIGURATIONS_TOPIC),
            (Constants.HOST_LEVEL_PARAMS_TOPIC_ENPOINT,
             initializer_module.host_level_params_cache,
             self.host_level_params_events_listener,
             Constants.HOST_LEVEL_PARAMS_TOPIC),
            (Constants.ALERTS_DEFINITIONS_REQUEST_ENDPOINT,
             initializer_module.alert_definitions_cache,
             self.alert_definitions_events_listener,
             Constants.ALERTS_DEFINITIONS_TOPIC)
        ]
        self.responseId = 0
        self.file_cache = initializer_module.file_cache
        self.stale_alerts_monitor = initializer_module.stale_alerts_monitor
        self.post_registration_actions = [
            self.file_cache.reset, initializer_module.
            component_status_executor.clean_not_existing_clusters_info,
            initializer_module.alert_status_reporter.
            clean_not_existing_clusters_info,
            initializer_module.host_status_reporter.clean_cache
        ]