Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
adea539b
Commit
adea539b
authored
Jun 17, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): add link to panel png
parent
ea4b14ac
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
emails/templates/alert_notification.html
+4
-2
pkg/services/alerting/notifier.go
+1
-0
pkg/services/notifications/notifications_test.go
+2
-1
public/emails/alert_notification.html
+4
-2
No files found.
emails/templates/alert_notification.html
View file @
adea539b
...
@@ -3,14 +3,16 @@
...
@@ -3,14 +3,16 @@
[[Subject .Subject "Grafana Alert: [ [[.State]] ] [[.Name]]" ]]
[[Subject .Subject "Grafana Alert: [ [[.State]] ] [[.Name]]" ]]
Alertstate: [[.State]]
<br
/>
Alertstate: [[.State]]
<br
/>
[[.AlertPageUrl]]
"
<br
/>
[[.AlertPageUrl]]
<br
/>
[[.DashboardLink]]
"
<br
/>
[[.DashboardLink]]
<br
/>
[[.Description]]
<br
/>
[[.Description]]
<br
/>
[[if eq .State "Ok"]]
[[if eq .State "Ok"]]
Everything is Ok
Everything is Ok
[[end]]
[[end]]
<img
src=
"[[.DashboardImage]]"
/>
[[if ne .State "Ok" ]]
[[if ne .State "Ok" ]]
<table
class=
"row"
>
<table
class=
"row"
>
<tr>
<tr>
...
...
pkg/services/alerting/notifier.go
View file @
adea539b
...
@@ -64,6 +64,7 @@ func (this *EmailNotifier) Dispatch(alertResult *AlertResult) {
...
@@ -64,6 +64,7 @@ func (this *EmailNotifier) Dispatch(alertResult *AlertResult) {
"TriggeredAlerts"
:
alertResult
.
TriggeredAlerts
,
"TriggeredAlerts"
:
alertResult
.
TriggeredAlerts
,
"DashboardLink"
:
grafanaUrl
+
"/dashboard/db/alerting"
,
"DashboardLink"
:
grafanaUrl
+
"/dashboard/db/alerting"
,
"AlertPageUrl"
:
grafanaUrl
+
"/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
},
To
:
[]
string
{
this
.
To
},
Template
:
"alert_notification.html"
,
Template
:
"alert_notification.html"
,
...
...
pkg/services/notifications/notifications_test.go
View file @
adea539b
...
@@ -50,6 +50,7 @@ func TestNotifications(t *testing.T) {
...
@@ -50,6 +50,7 @@ func TestNotifications(t *testing.T) {
"Description"
:
"Description"
,
"Description"
:
"Description"
,
"DashboardLink"
:
"http://localhost:3000/dashboard/db/alerting"
,
"DashboardLink"
:
"http://localhost:3000/dashboard/db/alerting"
,
"AlertPageUrl"
:
"http://localhost:3000/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
{
"TriggeredAlerts"
:
[]
testTriggeredAlert
{
{
Name
:
"desktop"
,
State
:
"Critical"
,
ActualValue
:
13
},
{
Name
:
"desktop"
,
State
:
"Critical"
,
ActualValue
:
13
},
{
Name
:
"mobile"
,
State
:
"Warn"
,
ActualValue
:
5
},
{
Name
:
"mobile"
,
State
:
"Warn"
,
ActualValue
:
5
},
...
@@ -68,7 +69,6 @@ func TestNotifications(t *testing.T) {
...
@@ -68,7 +69,6 @@ func TestNotifications(t *testing.T) {
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"Warn"
)
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"Warn"
)
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"mobile"
)
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"mobile"
)
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"desktop"
)
So
(
sentMsg
.
Body
,
ShouldContainSubstring
,
"desktop"
)
So
(
sentMsg
.
Subject
,
ShouldContainSubstring
,
"Grafana Alert: [ Critical ] "
)
So
(
sentMsg
.
Subject
,
ShouldContainSubstring
,
"Grafana Alert: [ Critical ] "
)
})
})
...
@@ -79,6 +79,7 @@ func TestNotifications(t *testing.T) {
...
@@ -79,6 +79,7 @@ func TestNotifications(t *testing.T) {
"State"
:
"Warn"
,
"State"
:
"Warn"
,
"Description"
:
"Description"
,
"Description"
:
"Description"
,
"DashboardLink"
:
"http://localhost:3000/dashboard/db/alerting"
,
"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"
,
"AlertPageUrl"
:
"http://localhost:3000/alerting"
,
"TriggeredAlerts"
:
[]
testTriggeredAlert
{
"TriggeredAlerts"
:
[]
testTriggeredAlert
{
{
Name
:
"desktop"
,
State
:
"Critical"
,
ActualValue
:
13
},
{
Name
:
"desktop"
,
State
:
"Critical"
,
ActualValue
:
13
},
...
...
public/emails/alert_notification.html
View file @
adea539b
...
@@ -118,8 +118,8 @@ color: #FFFFFF !important;
...
@@ -118,8 +118,8 @@ color: #FFFFFF !important;
{{Subject .Subject "Grafana Alert: [ {{.State}} ] {{.Name}}" }}
{{Subject .Subject "Grafana Alert: [ {{.State}} ] {{.Name}}" }}
Alertstate: {{.State}}
<br
/>
Alertstate: {{.State}}
<br
/>
{{.AlertPageUrl}}
"
<br
/>
{{.AlertPageUrl}}
<br
/>
{{.DashboardLink}}
"
<br
/>
{{.DashboardLink}}
<br
/>
{{.Description}}
<br
/>
{{.Description}}
<br
/>
{{if eq .State "Ok"}}
{{if eq .State "Ok"}}
...
@@ -127,6 +127,8 @@ Alertstate: {{.State}}<br />
...
@@ -127,6 +127,8 @@ Alertstate: {{.State}}<br />
{{end}}
{{end}}
{{if ne .State "Ok" }}
{{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%"
>
<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"
>
<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>
<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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment