Skip to content

Commit 1951633

Browse files
author
Felix Breidenstein
committed
Switch message and keyword in the Alamos alert
1 parent 704ccec commit 1951633

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ func inputHandler(client *alamos.Client, debug bool) http.Handler {
6060
severity := alert.Labels["severity"]
6161
switch strings.ToUpper(severity) {
6262
case "PAGE":
63-
var alertText string
63+
var alertMessage string
6464
alertData := make(map[string]string)
6565

6666
description, ok := alert.Annotations["description"]
6767
if ok {
68-
alertText = description
68+
alertData["keyword"] = description
6969
} else {
70-
alertText = alert.Labels["alertname"]
70+
alertData["keyword"] = alert.Labels["alertname"]
7171
}
7272

7373
summary, ok := alert.Annotations["summary"]
7474
if ok {
75-
alertData["keyword"] = summary
75+
alertMessage = summary
7676
} else {
77-
alertData["keyword"] = fmt.Sprintf("Instance: %s", alert.Labels["instance"])
77+
alertMessage = fmt.Sprintf("Instance: %s", alert.Labels["instance"])
7878
}
7979

80-
err := client.SendAlert(alertText, alertData)
80+
err := client.SendAlert(alertMessage, alertData)
8181
if err != nil {
8282
w.WriteHeader(http.StatusInternalServerError)
8383
w.Write([]byte("ERROR"))

0 commit comments

Comments
 (0)