Пример #1
0
    def _send_bay_metrics(self, ctx):
        LOG.debug('Starting to send bay metrics')
        for bay in objects.Bay.list(ctx):
            data = None
            try:
                data = monitor.pull_data(list(bay.node_addresses))
            except Exception as e:
                LOG.warn(_LW("Skip pulling data from bay %(bay)s due to "
                             "error: %(e)s"),
                         {'e': e, 'bay': bay.uuid}, exc_info=True)
                continue

            metrics = []
            metric = {
                'name': 'memory_util',
                'unit': '%',
                'value': data
            }
            metrics.append(metric)

            message = dict(metrics=metrics,
                           user_id=bay.user_id,
                           project_id=bay.project_id,
                           resource_id=bay.uuid)
            LOG.debug("About to send notification: '%s'" % message)
            rpc.get_notifier().info(ctx, "magnum.bay.metrics.update",
                                    message)
Пример #2
0
def notify_about_cluster_operation(context, action, outcome):
    """Send a notification about cluster operation.

    :param action: CADF action being audited
    :param outcome: CADF outcome
    """
    notifier = rpc.get_notifier()
    event = eventfactory.EventFactory().new_event(
        eventType=cadftype.EVENTTYPE_ACTIVITY,
        outcome=outcome,
        action=action,
        initiator=_get_request_audit_info(context),
        target=resource.Resource(typeURI='service/magnum/cluster'),
        observer=resource.Resource(typeURI='service/magnum/cluster'))
    service = 'magnum'
    event_type = '%(service)s.cluster.%(action)s' % {
        'service': service, 'action': action}
    payload = event.as_dict()

    if outcome == taxonomy.OUTCOME_FAILURE:
        method = notifier.error
    else:
        method = notifier.info

    method(context, event_type, payload)
Пример #3
0
 def __init__(self, conf):
     super(MagnumPeriodicTasks, self).__init__(conf)
     self.notifier = rpc.get_notifier()
Пример #4
0
 def __init__(self, conf, binary):
     self.magnum_service_ref = None
     self.host = conf.host
     self.binary = binary
     super(MagnumPeriodicTasks, self).__init__(conf)
     self.notifier = rpc.get_notifier()
Пример #5
0
 def __init__(self, conf, binary):
     self.magnum_service_ref = None
     self.host = conf.host
     self.binary = binary
     super(MagnumPeriodicTasks, self).__init__(conf)
     self.notifier = rpc.get_notifier()
Пример #6
0
 def __init__(self, conf):
     super(MagnumPeriodicTasks, self).__init__(conf)
     self.notifier = rpc.get_notifier()