Skip to content

Alarm Notifier : No notification #78

@vgeannin

Description

@vgeannin

When found that since you have introduce some modification in the Collector in the 4.6 version we didn't receive Alarm using Alarm Notifier.
In the 4.6, you have put un the conf file "metric_type": "ALL" for fmdata :

{ "api": "/network-hardware-groups/{nhg_id}/fmdata", "type": "ACTIVE", "metric_type": "ALL", "interval": 30 }, { "api": "/network-hardware-groups/{nhg_id}/fmdata", "type": "HISTORY", "metric_type": "ALL", "interval": 1, "sync_duration": 15 }

But in Alarm_notifier you use this value to create the "getAlarmUniqueID"

func getAlarmUniqueID(alarm FMSource, metricType string) string {
var keys []string
if metricType == "RADIO" {
keys = []string{alarm.FmDataSource.HwID, alarm.FmDataSource.Dn, alarm.FmData.AlarmIdentifier, alarm.FmData.SpecificProblem, alarm.FmData.EventTime}
} else if metricType == "DAC" {
keys = []string{alarm.FmDataSource.Dn, alarm.FmData.AlarmIdentifier, alarm.FmData.EventTime}
} else if metricType == "CORE" {
keys = []string{alarm.FmDataSource.NhgID, alarm.FmDataSource.EdgeID, alarm.FmData.AlarmIdentifier, alarm.FmData.EventTime}
}
id := strings.Join(keys, "_")
return id
}

So the generation didn't work.
To restore the AlarmNotification, I modify the struct "FmDataSource"to get MetricType in the Alarm:

FmDataSource struct {
ApID string json:"ap_id"
AppID string json:"app_id"
AppName string json:"app_name"
ClusterID string json:"cluster_id"
DcID string json:"dc_id"
DcName string json:"dc_name"
Dn string json:"dn"
EdgeAlias string json:"edge_alias"
EdgeHostname string json:"edge_hostname"
EdgeID string json:"edge_id"
HwAlias string json:"hw_alias"
HwID string json:"hw_id"
MetricType string json:"metric_type"
NhgAlias string json:"nhg_alias"
NhgID string json:"nhg_id"
SerialNo string json:"serial_no"
SliceID string json:"slice_id"
Technology string json:"technology"
} json:"fm_data_source"

Then I modify the "getAlarmDetails" function to retrieve the MetricType from the alarm (metricType := v.FmDataSource.MetricType) :

func getAlarmDetails(txnID uint64, fmData string, metricType string) []FMSource {
var data []FMSource
var alarmToNotify []FMSource
err := json.Unmarshal([]byte(fmData), &data)
if err != nil {
log.WithFields(log.Fields{"tid": txnID, "error": err}).Errorf("Unable to parse json fm data")
return alarmToNotify
}

removeOldRaisedAlarms()
for _, v := range data {
var isValid bool
metricType := v.FmDataSource.MetricType
if !(alarmNotifier.SeverityThreshold == "" || alarmNotifier.SeverityThreshold == "NONE") {
isValid = checkSeverity(v.FmData.Severity)
log.Debugf("severity: %v, isValid: %v", v.FmData.Severity, isValid)
} else if metricType == "RADIO" {
isValid = checkRadioAlarmFilter(v.FmData.SpecificProblem, v.FmData.AdditionalText, alarmNotifier.RadioAlarmFilters)
} else if metricType == "DAC" {
isValid = checkAlarmIDFilter(v.FmData.AlarmIdentifier, alarmNotifier.DACAlarmFilters)
} else if metricType == "CORE" {
isValid = checkAlarmIDFilter(v.FmData.AlarmIdentifier, alarmNotifier.COREAlarmFilters)
}

Can you apply this patch
Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions