Exemplo n.º 1
0
 def _init_listener(self, topic, callback):
     if not topic:
         return
     return messaging.get_notification_listener(
         transport=messaging.get_transport(self._conf),
         targets=[oslo_messaging.Target(topic=topic)],
         endpoints=[PushNotificationsEndpoint(callback)])
Exemplo n.º 2
0
    def __init__(self, conf):
        self.oslo_notifiers = {}
        try:
            notifier_plugins = conf.notifiers

            LOG.debug('notifier_plugins: %s', notifier_plugins)

            if not notifier_plugins:
                LOG.info('Evaluator Notifier is disabled')
                return

            topic_prefix = \
                conf.evaluator_actions.evaluator_notification_topic_prefix

            for notifier in notifier_plugins:
                LOG.debug('Adding evaluator notifier %s', notifier)

                self.oslo_notifiers[notifier] = oslo_messaging.Notifier(
                    get_transport(conf),
                    driver='messagingv2',
                    publisher_id='vitrage.evaluator',
                    topics=[topic_prefix + '.' + notifier])

        except Exception as e:
            LOG.info('Evaluator Notifier - missing configuration %s' % str(e))
Exemplo n.º 3
0
 def __init__(self, conf):
     self.oslo_notifier = None
     topics = [conf.persistency.persistor_topic]
     self.oslo_notifier = oslo_messaging.Notifier(
         get_transport(conf),
         driver='messagingv2',
         publisher_id='vitrage.graph',
         topics=topics)
Exemplo n.º 4
0
    def _get_topic_listener(self, conf, topic, callback):
        # Create a listener for each topic
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(topic=topic)]

        return messaging.get_notification_listener(
            transport, targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Exemplo n.º 5
0
 def _create_datasources_event_listener(self):
     topic = self.conf.datasources.notification_topic_collector
     transport = messaging.get_transport(self.conf)
     targets = [oslo_messaging.Target(topic=topic)]
     return messaging.get_notification_listener(transport, targets, [
         PushNotificationsEndpoint(self.processor.process_event,
                                   self.processor_lock)
     ])
Exemplo n.º 6
0
 def __init__(self, conf):
     super(VitrageNotifierService, self).__init__()
     self.conf = conf
     self.notifiers = self.get_notifier_plugins(conf)
     transport = messaging.get_transport(conf)
     target = oslo_messaging.Target(topic=conf.entity_graph.notifier_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target], [VitrageEventEndpoint(self.notifiers)])
Exemplo n.º 7
0
 def __init__(self, worker_id):
     super(MachineLearningService, self).__init__(worker_id)
     self.machine_learning_plugins = self.get_machine_learning_plugins()
     transport = messaging.get_transport()
     target = \
         oslo_m.Target(topic=CONF.machine_learning.machine_learning_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitrageEventEndpoint(self.machine_learning_plugins)])
Exemplo n.º 8
0
 def __init__(self, conf):
     super(VitrageNotifierService, self).__init__()
     self.conf = conf
     self.notifiers = self.get_notifier_plugins(conf)
     transport = messaging.get_transport(conf)
     target = oslo_messaging.Target(topic=conf.entity_graph.notifier_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitrageEventEndpoint(self.notifiers)])
Exemplo n.º 9
0
    def _get_topic_listener(self, conf, topic, callback):
        # Create a listener for each topic
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(topic=topic, exchange='nova')]

        return messaging.get_notification_listener(
            transport,
            targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Exemplo n.º 10
0
 def __init__(self, conf):
     super(StressNotificationsService, self).__init__()
     self.oslo_notifier = None
     topic = conf.datasources.notification_topic
     self.oslo_notifier = oslo_messaging.Notifier(
         get_transport(conf),
         driver='messagingv2',
         publisher_id='vitrage.stress',
         topics=[topic])
Exemplo n.º 11
0
    def get_listener(self):
        topics = self._conf.datasources.notification_topics
        exchange = self._conf.datasources.notification_exchange
        transport = messaging.get_transport(self._conf)
        targets = [
            oslo_messaging.Target(exchange=exchange, topic=topic)
            for topic in topics
        ]

        return messaging.get_notification_listener(transport, targets, [self])
Exemplo n.º 12
0
 def __init__(self, worker_id, conf, db_connection):
     super(PersistorService, self).__init__(worker_id)
     self.conf = conf
     self.db_connection = db_connection
     transport = messaging.get_transport(conf)
     target = \
         oslo_m.Target(topic=conf.persistency.persistor_topic)
     self.listener = messaging.get_notification_listener(
         transport, [target],
         [VitragePersistorEndpoint(self.db_connection)])
Exemplo n.º 13
0
    def _get_topics_listener(self, conf, callback):
        topics = conf.datasources.notification_topics
        exchange = conf.datasources.notification_exchange
        transport = messaging.get_transport(conf)
        targets = [oslo_messaging.Target(exchange=exchange, topic=topic)
                   for topic in topics]

        return messaging.get_notification_listener(
            transport,
            targets,
            [NotificationsEndpoint(self.enrich_callbacks_by_events, callback)])
Exemplo n.º 14
0
 def __init__(self, conf):
     self.oslo_notifier = None
     topics = self._get_topics(conf)
     if not topics:
         LOG.info('Graph Notifier is disabled')
         return
     self.oslo_notifier = oslo_messaging.Notifier(
         get_transport(conf),
         driver='messagingv2',
         publisher_id='vitrage.graph',
         topics=topics)
Exemplo n.º 15
0
 def __init__(self, worker_id):
     super(StressNotificationsService, self).__init__(worker_id)
     self.oslo_notifier = None
     topics = CONF.datasources.notification_topics
     self.oslo_notifier = oslo_messaging.Notifier(
         get_transport(),
         driver='messagingv2',
         publisher_id='vitrage.stress',
         topics=topics)
     self.periodic = periodics.PeriodicWorker.create(
         [], executor_factory=lambda: ThreadPoolExecutor(max_workers=10))
Exemplo n.º 16
0
 def _init_oslo_notifier(self):
     self.oslo_notifier = None
     try:
         self.publisher = 'vitrage-snmp-parsing'
         self.oslo_notifier = oslo_messaging.Notifier(
             get_transport(self.conf),
             driver='messagingv2',
             publisher_id=self.publisher,
             topics=['vitrage_notifications'])
     except Exception:
         LOG.exception('Failed to initialize oslo notifier')
Exemplo n.º 17
0
    def _init_oslo_notifier(self):
        self.oslo_notifier = None
        try:
            self.publisher = 'api_%s' % socket.gethostname()

            self.oslo_notifier = oslo_messaging.Notifier(
                get_transport(),
                driver='messagingv2',
                publisher_id=self.publisher,
                topics=['vitrage_notifications'])
        except Exception:
            LOG.exception('Failed to initialize oslo notifier')
Exemplo n.º 18
0
 def __init__(self, conf):
     self.oslo_notifier = None
     try:
         topic = conf.datasources.notification_topic_collector
         self.oslo_notifier = oslo_messaging.Notifier(
             get_transport(conf),
             driver='messagingv2',
             publisher_id='datasources.events',
             topics=[topic])
     except Exception as e:
         LOG.info('Collector notifier - missing configuration %s'
                  % str(e))
Exemplo n.º 19
0
    def _init_listeners(self, conf):
        self.listeners = []
        transport = messaging.get_transport(conf)

        self._init_notifier(transport=transport,
                            topic=conf.entity_graph.notifier_topic,
                            endpoint=VitrageDefaultEventEndpoint(
                                self.notifiers))

        for notifier in self.notifiers:
            if notifier.use_private_topic():
                self._init_notifier(transport=transport,
                                    topic=notifier.get_notifier_name(),
                                    endpoint=notifier)
Exemplo n.º 20
0
    def __init__(self, conf):
        self.oslo_notifier = None
        try:
            topic = conf.entity_graph.notifier_topic
            notifier_plugins = conf.notifiers
            if not topic or not notifier_plugins:
                LOG.info('Graph Notifier is disabled')
                return

            self.oslo_notifier = oslo_messaging.Notifier(
                get_transport(conf),
                driver='messagingv2',
                publisher_id='vitrage.graph',
                topics=[topic])
        except Exception as e:
            LOG.info('Graph Notifier - missing configuration %s' % str(e))
Exemplo n.º 21
0
    def __init__(self, conf):
        self.oslo_notifier = None
        try:
            topics = [conf.datasources.notification_topic_collector]
            if conf.persistor.persist_events:
                topics.append(conf.persistor.persistor_topic)
            else:
                LOG.warning("Not persisting events")

            self.oslo_notifier = oslo_messaging.Notifier(
                get_transport(conf),
                driver='messagingv2',
                publisher_id='datasources.events',
                topics=topics)
        except Exception as e:
            LOG.info('Collector notifier - missing configuration %s' % str(e))
Exemplo n.º 22
0
    def __init__(self, conf):
        self.oslo_notifier = None
        try:
            topic = conf.entity_graph.notifier_topic
            notifier_plugins = conf.notifiers
            if not topic or not notifier_plugins:
                LOG.info('DeducedAlarmNotifier is disabled')
                return

            self.oslo_notifier = oslo_messaging.Notifier(
                get_transport(conf),
                driver='messagingv2',
                publisher_id='vitrage.deduced',
                topic=topic)
        except Exception:
            LOG.info('DeducedAlarmNotifier missing configuration')
Exemplo n.º 23
0
    def __init__(self, conf):
        self.oslo_notifier = None
        try:
            topic = conf.entity_graph.notifier_topic
            notifier_plugins = conf.notifiers
            if not topic or not notifier_plugins:
                LOG.info('DeducedAlarmNotifier is disabled')
                return

            self.oslo_notifier = oslo_messaging.Notifier(
                get_transport(conf),
                driver='messagingv2',
                publisher_id='vitrage.deduced',
                topic=topic)
        except Exception as e:
            LOG.info('DeducedAlarmNotifier missing configuration %s' % str(e))
Exemplo n.º 24
0
    def start(self):
        LOG.info("Vitrage Api Handler Service - Starting...")

        super(VitrageApiHandlerService, self).start()

        transport = messaging.get_transport(self.conf)
        rabbit_hosts = self.conf.oslo_messaging_rabbit.rabbit_hosts
        target = oslo_messaging.Target(topic=self.conf.rpc_topic,
                                       server=rabbit_hosts)

        endpoints = [EntityGraphApis(self.entity_graph), ]

        server = vitrage_rpc.get_server(target, endpoints, transport)

        server.start()

        LOG.info("Vitrage Api Handler Service - Started!")
Exemplo n.º 25
0
    def _init_listeners(self):
        self.listeners = []
        transport = messaging.get_transport()

        self._init_notifier(transport=transport,
                            topic=CONF.entity_graph.notifier_topic,
                            endpoint=VitrageDefaultEventEndpoint(
                                self.notifiers))

        topic_prefix = \
            CONF.evaluator_actions.evaluator_notification_topic_prefix

        for notifier in self.notifiers:
            if notifier.use_private_topic():
                self._init_notifier(transport=transport,
                                    topic=topic_prefix + '.' +
                                    notifier.get_notifier_name(),
                                    endpoint=notifier)
Exemplo n.º 26
0
    def start(self):
        LOG.info("Vitrage Api Handler Service - Starting...")

        super(VitrageApiHandlerService, self).start()

        transport = messaging.get_transport(self.conf)
        rabbit_hosts = self.conf.oslo_messaging_rabbit.rabbit_hosts
        target = oslo_messaging.Target(topic=self.conf.rpc_topic,
                                       server=rabbit_hosts)

        endpoints = [
            EntityGraphApis(self.entity_graph),
        ]

        server = vitrage_rpc.get_server(target, endpoints, transport)

        server.start()

        LOG.info("Vitrage Api Handler Service - Started!")
Exemplo n.º 27
0
    def start(self):
        LOG.info("Vitrage Api Handler Service - Starting...")

        super(VitrageApiHandlerService, self).start()

        transport = messaging.get_transport(self.conf)
        rabbit_hosts = self.conf.oslo_messaging_rabbit.rabbit_hosts
        target = oslo_messaging.Target(topic=self.conf.rpc_topic,
                                       server=rabbit_hosts)

        endpoints = [TopologyApis(self.entity_graph, self.conf),
                     AlarmApis(self.entity_graph, self.conf),
                     RcaApis(self.entity_graph, self.conf),
                     TemplateApis(self.scenario_repo.templates)]

        server = vitrage_rpc.get_server(target, endpoints, transport)

        server.start()

        LOG.info("Vitrage Api Handler Service - Started!")
Exemplo n.º 28
0
    def start(self):
        LOG.info("Vitrage Api Handler Service - Starting...")

        super(VitrageApiHandlerService, self).start()

        transport = messaging.get_transport(self.conf)
        rabbit_hosts = self.conf.oslo_messaging_rabbit.rabbit_hosts
        target = oslo_messaging.Target(topic=self.conf.rpc_topic,
                                       server=rabbit_hosts)

        endpoints = [
            TopologyApis(self.entity_graph, self.conf),
            AlarmApis(self.entity_graph, self.conf),
            RcaApis(self.entity_graph, self.conf),
            TemplateApis(self.scenario_repo.templates),
            EventApis(self.conf),
            ResourceApis(self.entity_graph, self.conf)
        ]

        server = vitrage_rpc.get_server(target, endpoints, transport)

        server.start()

        LOG.info("Vitrage Api Handler Service - Started!")
Exemplo n.º 29
0
 def __init__(self, conf):
     transport = messaging.get_transport(conf)
     target = oslo_messaging.Target(topic=conf.rpc_topic)
     self.client = vitrage_rpc.get_client(transport, target)