-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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 stringjson:"ap_id"
AppID stringjson:"app_id"
AppName stringjson:"app_name"
ClusterID stringjson:"cluster_id"
DcID stringjson:"dc_id"
DcName stringjson:"dc_name"
Dn stringjson:"dn"
EdgeAlias stringjson:"edge_alias"
EdgeHostname stringjson:"edge_hostname"
EdgeID stringjson:"edge_id"
HwAlias stringjson:"hw_alias"
HwID stringjson:"hw_id"
MetricType stringjson:"metric_type"
NhgAlias stringjson:"nhg_alias"
NhgID stringjson:"nhg_id"
SerialNo stringjson:"serial_no"
SliceID stringjson:"slice_id"
Technology stringjson:"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,