Update alert fields 36/4036/2
authorMohamed Abukar <abukar.mohamed@nokia.com>
Tue, 9 Jun 2020 12:26:00 +0000 (15:26 +0300)
committerMohamed Abukar <abukar.mohamed@nokia.com>
Tue, 9 Jun 2020 12:29:42 +0000 (15:29 +0300)
Change-Id: Ib7a5e93cabcc5164c060cd01e7037b9b709c454c
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
adapter/build_adapter_ubuntu.sh
adapter/cmd/adapter.go
adapter/container-tag.yaml

index 5edd93d..3bb4703 100755 (executable)
@@ -22,12 +22,12 @@ set -eux
 echo "--> build_adapter_ubuntu.sh starts"
 
 # Install RMR from deb packages at packagecloud.io
-rmr=rmr_3.7.2_amd64.deb
-wget --content-disposition  https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmr/download.deb
+rmr=rmr_4.0.2_amd64.deb
+wget --content-disposition  https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmr/download.deb
 sudo dpkg -i $rmr
 rm $rmr
-rmrdev=rmr-dev_3.7.2_amd64.deb
-wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmrdev/download.deb
+rmrdev=rmr-dev_4.0.2_amd64.deb
+wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmrdev/download.deb
 sudo dpkg -i $rmrdev
 rm $rmrdev
 
@@ -58,7 +58,7 @@ hash=$(git rev-parse --short HEAD || true)
 go build -a -installsuffix cgo -ldflags "-X main.Version=$tag -X main.Hash=$hash" -o alarm-adapter ./cmd/*.go
 
 # Execute UT and measure coverage for the Alarm Library
-#cd ../alarm && go test . -v -coverprofile cover.out
+cd ../alarm && go test . -v -coverprofile cover.out
 
 # And for the Alarm Adapter
 cd ../adapter && go test -v -p 1 -coverprofile cover.out ./cmd/ -c -o ./adapter_test && ./adapter_test
index 0b2ddce..76112f9 100755 (executable)
@@ -201,11 +201,11 @@ func (a *AlarmAdapter) GenerateAlertLabels(newAlarm alarm.Alarm, status AlertSta
                "alertname":   alarmDef.AlarmText,
                "severity":    string(newAlarm.PerceivedSeverity),
                "service":     fmt.Sprintf("%s:%s", newAlarm.ManagedObjectId, newAlarm.ApplicationId),
-               "system_name": "RIC",
+               "system_name": fmt.Sprintf("RIC:%s:%s", newAlarm.ManagedObjectId, newAlarm.ApplicationId),
        }
        amAnnotations := models.LabelSet{
-               "alarm_id":        string(alarmDef.AlarmId),
-               "description":     newAlarm.IdentifyingInfo,
+               "alarm_id":        fmt.Sprintf("%d", alarmDef.AlarmId),
+               "description":     fmt.Sprintf("%d:%s:%s", newAlarm.SpecificProblem, newAlarm.IdentifyingInfo, newAlarm.AdditionalInfo),
                "additional_info": newAlarm.AdditionalInfo,
                "summary":         alarmDef.EventType,
                "instructions":    alarmDef.OperationInstructions,
@@ -229,7 +229,7 @@ func (a *AlarmAdapter) PostAlert(amLabels, amAnnotations models.LabelSet) (*aler
        }
        alertParams := alert.NewPostAlertsParams().WithAlerts(models.PostableAlerts{pa})
 
-       app.Logger.Info("Posting alerts: labels: %v, annotations: %v", amLabels, amAnnotations)
+       app.Logger.Info("Posting alerts: labels: %+v, annotations: %+v", amLabels, amAnnotations)
        ok, err := a.NewAlertmanagerClient().Alert.PostAlerts(alertParams)
        if err != nil {
                app.Logger.Error("Posting alerts to '%s/%s' failed with error: %v", a.amHost, a.amBaseUrl, err)
index cfdbfb8..a89789a 100644 (file)
@@ -2,4 +2,4 @@
 # By default this file is in the docker build directory,
 # but the location can configured in the JJB template.
 ---
-tag: 0.4.4
+tag: 0.4.5