diff --git a/emails/templates/alert_notification.html b/emails/templates/alert_notification.html
index 94d405bbb9d..52f0210e4ca 100644
--- a/emails/templates/alert_notification.html
+++ b/emails/templates/alert_notification.html
@@ -1,12 +1,56 @@
-[[Subject .Subject "Grafana Alert: [[.Severity]] [[.RuleName]]"]]
+[[Subject .Subject "[[.Title]]"]]
-
-
+
-Alert rule: [[.RuleName]]
-Alert state: [[.RuleState]]
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
-Link to alert rule
+
-
diff --git a/pkg/services/alerting/engine.go b/pkg/services/alerting/engine.go
index 9befd02c1c8..e3813b8e912 100644
--- a/pkg/services/alerting/engine.go
+++ b/pkg/services/alerting/engine.go
@@ -72,7 +72,7 @@ func (e *Engine) alertingTicker() {
func (e *Engine) execDispatcher() {
for job := range e.execQueue {
- e.log.Debug("Starting executing alert rule %s", job.Rule.Name)
+ e.log.Debug("Starting executing alert rule", "alert id", job.Rule.Id)
go e.executeJob(job)
}
}
diff --git a/pkg/services/alerting/eval_context.go b/pkg/services/alerting/eval_context.go
index 486d26b3fc0..1c94f80842d 100644
--- a/pkg/services/alerting/eval_context.go
+++ b/pkg/services/alerting/eval_context.go
@@ -100,6 +100,6 @@ func NewEvalContext(rule *Rule) *EvalContext {
Events: make([]*Event, 0),
DoneChan: make(chan bool, 1),
CancelChan: make(chan bool, 1),
- log: log.New("alerting.engine"),
+ log: log.New("alerting.evalContext"),
}
}
diff --git a/pkg/services/alerting/notifiers/email.go b/pkg/services/alerting/notifiers/email.go
index 546c23c3d31..913d1262a6e 100644
--- a/pkg/services/alerting/notifiers/email.go
+++ b/pkg/services/alerting/notifiers/email.go
@@ -8,6 +8,7 @@ import (
"github.com/grafana/grafana/pkg/metrics"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/alerting"
+ "github.com/grafana/grafana/pkg/setting"
)
func init() {
@@ -49,11 +50,14 @@ 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,
- "RuleUrl": ruleUrl,
+ "Title": context.GetNotificationTitle(),
+ "State": context.Rule.State,
+ "Name": context.Rule.Name,
+ "Severity": context.Rule.Severity,
+ "SeverityColor": context.GetColor(),
+ "RuleUrl": ruleUrl,
+ "ImageLink": context.ImagePublicUrl,
+ "AlertPageUrl": setting.AppUrl + "alerting",
},
To: this.Addresses,
Template: "alert_notification.html",
diff --git a/pkg/services/notifications/send_email_integration_test.go b/pkg/services/notifications/send_email_integration_test.go
index 7795921c3b7..fdde2f5d4b2 100644
--- a/pkg/services/notifications/send_email_integration_test.go
+++ b/pkg/services/notifications/send_email_integration_test.go
@@ -18,6 +18,7 @@ func TestEmailIntegrationTest(t *testing.T) {
setting.Smtp.Enabled = true
setting.Smtp.TemplatesPattern = "emails/*.html"
setting.Smtp.FromAddress = "from@address.com"
+ setting.BuildVersion = "4.0.0"
err := Init()
So(err, ShouldBeNil)
@@ -30,19 +31,17 @@ func TestEmailIntegrationTest(t *testing.T) {
cmd := &m.SendEmailCommand{
Data: map[string]interface{}{
- "Name": "Name",
- "State": "Critical",
- "Description": "Description",
- "DashboardLink": "http://localhost:3000/dashboard/db/alerting",
- "AlertPageUrl": "http://localhost:3000/alerting",
- "DashboardImage": "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=3&width=1000&height=500",
-
- "TriggeredAlerts": []testTriggeredAlert{
- {Name: "desktop", State: "Critical", ActualValue: 13},
- {Name: "mobile", State: "Warn", ActualValue: 5},
- },
+ "Title": "[CRITICAL] Imaginary timeserie alert",
+ "State": "Firing",
+ "Name": "Imaginary timeserie alert",
+ "Severity": "Critical",
+ "Message": "Alert message that will support markdown in some distant future.",
+ "RuleUrl": "http://localhost:3000/dashboard/db/graphite-dashboard",
+ "AlertPageUrl": "http://localhost:3000/alerting",
+ "ImageLink": "http://localhost:3000/render/dashboard-solo/db/graphite-dashboard?panelId=1&from=1471008499616&to=1471012099617&width=1000&height=500",
+ "SeverityColor": "#D63232",
},
- To: []string{"asd@asd.com "},
+ To: []string{"asdf@asdf.com "},
Template: "alert_notification.html",
}
diff --git a/public/emails/alert_notification.html b/public/emails/alert_notification.html
index 21dded9c783..fccd0559500 100644
--- a/public/emails/alert_notification.html
+++ b/public/emails/alert_notification.html
@@ -113,17 +113,61 @@ color: #FFFFFF !important;
- {{Subject .Subject "Grafana Alert: {{.Severity}} {{.RuleName}}"}}
+ {{Subject .Subject "{{.Title}}"}}
-
-
+
-Alert rule: {{.RuleName}}
-Alert state: {{.RuleState}}
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
-Link to alert rule
+
-
|