Explorar el Código

Add match values into Dingding notification message

Athurg Feng hace 7 años
padre
commit
ca6dd73923
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      pkg/services/alerting/notifiers/dingding.go

+ 6 - 0
pkg/services/alerting/notifiers/dingding.go

@@ -1,6 +1,8 @@
 package notifiers
 
 import (
+	"fmt"
+
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/components/simplejson"
 	"github.com/grafana/grafana/pkg/log"
@@ -61,6 +63,10 @@ func (this *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
 		message = title
 	}
 
+	for i, match := range evalContext.EvalMatches {
+		message += fmt.Sprintf("\\n%2d. %s value %s", i+1, match.Metric, match.Value)
+	}
+
 	bodyJSON, err := simplejson.NewJson([]byte(`{
 		"msgtype": "link",
 		"link": {