Commit adea539b by bergquist

feat(alerting): add link to panel png

parent ea4b14ac
......@@ -3,14 +3,16 @@
[[Subject .Subject "Grafana Alert: [ [[.State]] ] [[.Name]]" ]]
Alertstate: [[.State]]<br />
[[.AlertPageUrl]]"<br />
[[.DashboardLink]]"<br />
[[.AlertPageUrl]]<br />
[[.DashboardLink]]<br />
[[.Description]]<br />
[[if eq .State "Ok"]]
Everything is Ok
[[end]]
<img src="[[.DashboardImage]]" />
[[if ne .State "Ok" ]]
<table class="row">
<tr>
......
......@@ -64,6 +64,7 @@ func (this *EmailNotifier) Dispatch(alertResult *AlertResult) {
"TriggeredAlerts": alertResult.TriggeredAlerts,
"DashboardLink": grafanaUrl + "/dashboard/db/alerting",
"AlertPageUrl": grafanaUrl + "/alerting",
"DashboardImage": grafanaUrl + "/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500",
},
To: []string{this.To},
Template: "alert_notification.html",
......
......@@ -50,6 +50,7 @@ func TestNotifications(t *testing.T) {
"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=1&width=1000&height=500",
"TriggeredAlerts": []testTriggeredAlert{
{Name: "desktop", State: "Critical", ActualValue: 13},
{Name: "mobile", State: "Warn", ActualValue: 5},
......@@ -68,7 +69,6 @@ func TestNotifications(t *testing.T) {
So(sentMsg.Body, ShouldContainSubstring, "Warn")
So(sentMsg.Body, ShouldContainSubstring, "mobile")
So(sentMsg.Body, ShouldContainSubstring, "desktop")
So(sentMsg.Subject, ShouldContainSubstring, "Grafana Alert: [ Critical ] ")
})
......@@ -79,6 +79,7 @@ func TestNotifications(t *testing.T) {
"State": "Warn",
"Description": "Description",
"DashboardLink": "http://localhost:3000/dashboard/db/alerting",
"DashboardImage": "http://localhost:3000/render/dashboard-solo/db/alerting?from=1466169458375&to=1466171258375&panelId=1&width=1000&height=500",
"AlertPageUrl": "http://localhost:3000/alerting",
"TriggeredAlerts": []testTriggeredAlert{
{Name: "desktop", State: "Critical", ActualValue: 13},
......
......@@ -118,8 +118,8 @@ color: #FFFFFF !important;
{{Subject .Subject "Grafana Alert: [ {{.State}} ] {{.Name}}" }}
Alertstate: {{.State}}<br />
{{.AlertPageUrl}}"<br />
{{.DashboardLink}}"<br />
{{.AlertPageUrl}}<br />
{{.DashboardLink}}<br />
{{.Description}}<br />
{{if eq .State "Ok"}}
......@@ -127,6 +127,8 @@ Alertstate: {{.State}}<br />
{{end}}
{{if ne .State "Ok" }}
<img src="{{.DashboardImage}}" style="-ms-interpolation-mode: bicubic; clear: both; display: block; float: left; max-width: 100%; outline: none; text-decoration: none; width: auto" align="left" />
<table class="row" style="border-collapse: collapse; border-spacing: 0; display: block; padding: 0px; position: relative; text-align: left; vertical-align: top; width: 100%">
<tr style="padding: 0; text-align: left; vertical-align: top" align="left">
<td class="expander" style="-moz-hyphens: auto; -webkit-font-smoothing: antialiased; -webkit-hyphens: auto; -webkit-text-size-adjust: none; border-collapse: collapse !important; color: #222222; font-family: 'Open Sans', 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: normal; hyphens: auto; line-height: 19px; margin: 0; padding: 0; text-align: left; vertical-align: top; visibility: hidden; width: 0px; word-break: break-word" align="left" valign="top">Serie</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment