feat(annotations): working on alert annotations, #5694

This commit is contained in:
Torkel Ödegaard
2016-08-01 10:07:00 +02:00
parent c5e90b1801
commit 357358898d
17 changed files with 161 additions and 70 deletions
+1
View File
@@ -47,6 +47,7 @@ func (this *EmailNotifier) Notify(context *alerting.EvalContext) {
cmd := &m.SendEmailCommand{
Data: map[string]interface{}{
"Title": context.GetNotificationTitle(),
"RuleState": context.Rule.State,
"RuleName": context.Rule.Name,
"Severity": context.Rule.Severity,
+1 -3
View File
@@ -39,8 +39,6 @@ type SlackNotifier struct {
func (this *SlackNotifier) Notify(context *alerting.EvalContext) {
this.log.Info("Executing slack notification", "ruleId", context.Rule.Id, "notification", this.Name)
rule := context.Rule
ruleUrl, err := context.GetRuleUrl()
if err != nil {
this.log.Error("Failed get rule link", "error", err)
@@ -68,7 +66,7 @@ func (this *SlackNotifier) Notify(context *alerting.EvalContext) {
// "author_name": "Bobby Tables",
// "author_link": "http://flickr.com/bobby/",
// "author_icon": "http://flickr.com/icons/bobby.jpg",
"title": "[" + context.GetStateText() + "] " + rule.Name,
"title": context.GetNotificationTitle(),
"title_link": ruleUrl,
// "text": "Optional text that appears within the attachment",
"fields": fields,
+3 -1
View File
@@ -42,7 +42,9 @@ func (this *WebhookNotifier) Notify(context *alerting.EvalContext) {
this.log.Info("Sending webhook")
bodyJSON := simplejson.New()
bodyJSON.Set("name", context.Rule.Name)
bodyJSON.Set("title", context.GetNotificationTitle())
bodyJSON.Set("ruleId", context.Rule.Id)
bodyJSON.Set("ruleName", context.Rule.Name)
bodyJSON.Set("firing", context.Firing)
bodyJSON.Set("severity", context.Rule.Severity)