Ejemplo n.º 1
0
    def report_interface_state_fault(self, hostname, interface_id, severity):
        entity_type_id = self._get_interface_entity_type_id()
        entity_instance_id = \
            self._get_interface_entity_instance_id(hostname, interface_id)

        fm_severity = self._get_fault_severity(severity)

        if fm_severity == fm_constants.FM_ALARM_SEVERITY_CRITICAL:
            reason_text = _("'Data' Interface failed.")
        else:
            reason_text = _("'Data' Interface degraded.")

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_INTERFACE,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_severity,
            reason_text=reason_text,
            alarm_type=fm_constants.FM_ALARM_TYPE_4,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_29,
            proposed_repair_action=_("Check cabling and far-end port "
                                     "configuration and status on adjacent "
                                     "equipment."),
            service_affecting=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 2
0
    def report_bgp_peer_down_fault(self, host_id, agent_id, bgp_peer_id):
        """
        Generate a fault management alarm condition for BGP peer down
        """
        entity_type_id = self._get_bgp_peer_entity_type_id()
        entity_instance_id = self._get_bgp_peer_entity_instance_id(host_id,
                                                                   agent_id,
                                                                   bgp_peer_id)
        reason_text = (_("Dynamic routing agent %(agent_id)s lost connectivity"
                         " to peer %(bgp_peer_id)s.") %
                       {"agent_id": agent_id, "bgp_peer_id": bgp_peer_id})

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_BGP_PEER,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_constants.FM_ALARM_SEVERITY_MAJOR,
            reason_text=reason_text,
            alarm_type=fm_constants.FM_ALARM_TYPE_7,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_55,
            proposed_repair_action=(
                _("If condition persists, fix connectivity to peer.")),
            service_affecting=True,
            suppression=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 3
0
def _raise_alarm(ip=None):
    """Assert an NTP alarm"""

    if not ip:
        # Don't re-raise the alarm if its already raised
        if obj.alarm_raised is True:
            return False

        if obj.peer_selected:
            reason = "NTP cannot reach external time source; " \
                     "syncing with peer controller only"
            fm_severity = fm_constants.FM_ALARM_SEVERITY_MINOR
        else:
            reason = "NTP configuration does not contain any valid "
            reason += "or reachable NTP servers."
            fm_severity = fm_constants.FM_ALARM_SEVERITY_MAJOR

        eid = obj.base_eid

    else:
        reason = "NTP address "
        reason += ip
        reason += " is not a valid or a reachable NTP server."
        eid = obj.base_eid + '=' + ip
        fm_severity = fm_constants.FM_ALARM_SEVERITY_MINOR

    try:
        fault = fm_api.Fault(alarm_id=PLUGIN_ALARMID,
                             alarm_state=fm_constants.FM_ALARM_STATE_SET,
                             entity_type_id=fm_constants.FM_ENTITY_TYPE_HOST,
                             entity_instance_id=eid,
                             severity=fm_severity,
                             reason_text=reason,
                             alarm_type=obj.alarm_type,
                             probable_cause=obj.cause,
                             proposed_repair_action=obj.repair,
                             service_affecting=obj.service_affecting,
                             suppression=obj.suppression)

        alarm_uuid = api.set_fault(fault)
        if _is_uuid_like(alarm_uuid) is False:

            # Don't _add_unreachable_server list if the fm call failed.
            # That way it will be retried at a later time.
            collectd.error("%s 'set_fault' failed ; %s:%s ; %s" %
                           (PLUGIN, PLUGIN_ALARMID, eid, alarm_uuid))
            return True
        else:
            collectd.info("%s raised alarm %s:%s" %
                          (PLUGIN, PLUGIN_ALARMID, eid))
            if ip:
                _add_unreachable_server(ip)
            else:
                obj.alarm_raised = True

    except Exception as ex:
        collectd.error("%s 'set_fault' exception ; %s:%s:%s ; %s" %
                       (PLUGIN, PLUGIN_ALARMID, eid, fm_severity, ex))
    return True
Ejemplo n.º 4
0
    def report_providernet_fault(self, providernet_id):
        entity_type_id = self._get_providernet_entity_type_id()
        entity_instance_id = \
            self._get_providernet_entity_instance_id(providernet_id)

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_PROVIDERNET,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_constants.FM_ALARM_SEVERITY_MAJOR,
            reason_text=_("No enabled compute host with connectivity "
                          "to provider network."),
            alarm_type=fm_constants.FM_ALARM_TYPE_7,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_55,
            proposed_repair_action=_("Enable compute hosts with required "
                                     "provider network connectivity."),
            service_affecting=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 5
0
    def report_port_state_fault(self, hostname, port_id, severity):
        entity_type_id = self._get_port_entity_type_id()
        entity_instance_id = self._get_port_entity_instance_id(hostname,
                                                               port_id)
        fm_severity = self._get_fault_severity(severity)

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_PORT,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_severity,
            reason_text=_("'Data' Port failed."),
            alarm_type=fm_constants.FM_ALARM_TYPE_4,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_29,
            proposed_repair_action=_("Check cabling and far-end port "
                                     "configuration and status on adjacent "
                                     "equipment."),
            service_affecting=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 6
0
    def report_providernet_connectivity_fault(self, providernet_id, hostname,
                                              segmentation_ranges):
        entity_type_id = self._get_providernet_entity_type_id()
        entity_instance_id = \
            self._get_providernet_entity_instance_id(providernet_id, hostname)
        reason_text = self._get_providernet_connectivity_reason(
            providernet_id, hostname, segmentation_ranges)

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_PROVIDERNET_CONNECTIVITY,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_constants.FM_ALARM_SEVERITY_MAJOR,
            reason_text=reason_text,
            alarm_type=fm_constants.FM_ALARM_TYPE_7,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_55,
            proposed_repair_action=_("Check neighbour switch port VLAN"
                                     " assignments."),
            service_affecting=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 7
0
    def report_agent_fault(self, hostname, agent_id):
        """
        Generate a fault management alarm condition for agent alive
        """
        entity_type_id = self._get_agent_entity_type_id()
        entity_instance_id = self._get_agent_entity_instance_id(hostname,
                                                                agent_id)

        fault = fm_api.Fault(
            alarm_id=fm_constants.FM_ALARM_ID_NETWORK_AGENT,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=entity_type_id,
            entity_instance_id=entity_instance_id,
            severity=fm_constants.FM_ALARM_SEVERITY_MAJOR,
            reason_text=_("Networking Agent not responding."),
            alarm_type=fm_constants.FM_ALARM_TYPE_7,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_55,
            proposed_repair_action=(
                _("If condition persists, attempt to clear issue by "
                  "administratively locking and unlocking the Host.")),
            service_affecting=True)
        self.fm_api.set_fault(fault)
Ejemplo n.º 8
0
    def raise_alarm(self, alarm_uuid, alarm_data):
        DLOG.debug("Raising alarm, uuid=%s." % alarm_uuid)

        fm_alarm_id = _fm_alarm_id_mapping.get(alarm_data.alarm_type, None)
        if fm_alarm_id is not None:
            fm_alarm_type = _fm_alarm_type_mapping[alarm_data.event_type]
            fm_severity = _fm_alarm_severity_mapping[
                alarm_data.perceived_severity]
            fm_probable_cause = _fm_alarm_probable_cause[
                alarm_data.probable_cause]
            fm_uuid = None

            fault = fm_api.Fault(fm_alarm_id,
                                 fm_constants.FM_ALARM_STATE_SET,
                                 alarm_data.entity_type,
                                 alarm_data.entity,
                                 fm_severity,
                                 alarm_data.specific_problem_text,
                                 fm_alarm_type,
                                 fm_probable_cause,
                                 alarm_data.proposed_repair_action,
                                 alarm_data.service_affecting,
                                 alarm_data.suppression_allowed,
                                 fm_uuid,
                                 timestamp=alarm_data.raised_timestamp)

            response = self._fm_api.set_fault(fault)
            if response is None:
                self._alarm_db[alarm_uuid] = (alarm_data, None)
                DLOG.error("Failed to raise alarm, uuid=%s, fm_uuid=%s." %
                           (alarm_uuid, fm_uuid))
            else:
                fm_uuid = response
                self._alarm_db[alarm_uuid] = (alarm_data, fm_uuid)
                DLOG.info("Raised alarm, uuid=%s, fm_uuid=%s." %
                          (alarm_uuid, fm_uuid))
        else:
            DLOG.error("Unknown alarm type (%s) given." %
                       alarm_data.alarm_type)
Ejemplo n.º 9
0
def raise_alarm():
    """Raise Remote Logging Server Alarm"""

    repair = 'Ensure Remote Log Server IP is reachable from '
    repair += 'Controller through OAM interface; otherwise '
    repair += 'contact next level of support.'

    reason = 'Controller cannot establish connection with '
    reason += 'remote logging server.'

    try:
        fault = fm_api.Fault(
            alarm_id=PLUGIN_ALARMID,
            alarm_state=fm_constants.FM_ALARM_STATE_SET,
            entity_type_id=fm_constants.FM_ENTITY_TYPE_HOST,
            entity_instance_id=obj.base_eid,
            severity=fm_constants.FM_ALARM_SEVERITY_MINOR,
            reason_text=reason,
            alarm_type=fm_constants.FM_ALARM_TYPE_1,
            probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_6,
            proposed_repair_action=repair,
            service_affecting=False,
            suppression=False)

        alarm_uuid = api.set_fault(fault)
        if pc.is_uuid_like(alarm_uuid) is False:
            collectd.error("%s 'set_fault' failed ; %s:%s ; %s" %
                           (PLUGIN, PLUGIN_ALARMID,
                            obj.base_eid, alarm_uuid))
        else:
            collectd.info("%s %s:%s alarm raised" %
                          (PLUGIN, PLUGIN_ALARMID, obj.base_eid))
            obj.alarmed = True

    except Exception as ex:
        collectd.error("%s 'set_fault' exception ; %s:%s ; %s " %
                       (PLUGIN, PLUGIN_ALARMID, obj.base_eid, ex))