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
39f9db86
Commit
39f9db86
authored
Nov 01, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'utkarshcmu-slack_notifier'
parents
658fc1a6
63e2337f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
+22
-1
pkg/services/alerting/notifiers/slack.go
+10
-0
public/app/features/alerting/partials/notification_edit.html
+12
-1
No files found.
pkg/services/alerting/notifiers/slack.go
View file @
39f9db86
...
@@ -22,9 +22,12 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
...
@@ -22,9 +22,12 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
return
nil
,
alerting
.
ValidationError
{
Reason
:
"Could not find url property in settings"
}
return
nil
,
alerting
.
ValidationError
{
Reason
:
"Could not find url property in settings"
}
}
}
recipient
:=
model
.
Settings
.
Get
(
"recipient"
)
.
MustString
()
return
&
SlackNotifier
{
return
&
SlackNotifier
{
NotifierBase
:
NewNotifierBase
(
model
.
Id
,
model
.
IsDefault
,
model
.
Name
,
model
.
Type
,
model
.
Settings
),
NotifierBase
:
NewNotifierBase
(
model
.
Id
,
model
.
IsDefault
,
model
.
Name
,
model
.
Type
,
model
.
Settings
),
Url
:
url
,
Url
:
url
,
Recipient
:
recipient
,
log
:
log
.
New
(
"alerting.notifier.slack"
),
log
:
log
.
New
(
"alerting.notifier.slack"
),
},
nil
},
nil
}
}
...
@@ -32,6 +35,7 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
...
@@ -32,6 +35,7 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
type
SlackNotifier
struct
{
type
SlackNotifier
struct
{
NotifierBase
NotifierBase
Url
string
Url
string
Recipient
string
log
log
.
Logger
log
log
.
Logger
}
}
...
@@ -85,6 +89,12 @@ func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
...
@@ -85,6 +89,12 @@ func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
"ts"
:
time
.
Now
()
.
Unix
(),
"ts"
:
time
.
Now
()
.
Unix
(),
},
},
},
},
"parse"
:
"full"
,
// to linkify urls, users and channels in alert message.
}
//recipient override
if
this
.
Recipient
!=
""
{
body
[
"channel"
]
=
this
.
Recipient
}
}
data
,
_
:=
json
.
Marshal
(
&
body
)
data
,
_
:=
json
.
Marshal
(
&
body
)
...
...
public/app/features/alerting/partials/notification_edit.html
View file @
39f9db86
...
@@ -59,10 +59,21 @@
...
@@ -59,10 +59,21 @@
<div
class=
"gf-form-group"
ng-if=
"ctrl.model.type === 'slack'"
>
<div
class=
"gf-form-group"
ng-if=
"ctrl.model.type === 'slack'"
>
<h3
class=
"page-heading"
>
Slack settings
</h3>
<h3
class=
"page-heading"
>
Slack settings
</h3>
<div
class=
"gf-form"
>
<div
class=
"gf-form
max-width-30
"
>
<span
class=
"gf-form-label width-6"
>
Url
</span>
<span
class=
"gf-form-label width-6"
>
Url
</span>
<input
type=
"text"
required
class=
"gf-form-input max-width-30"
ng-model=
"ctrl.model.settings.url"
placeholder=
"Slack incoming webhook url"
></input>
<input
type=
"text"
required
class=
"gf-form-input max-width-30"
ng-model=
"ctrl.model.settings.url"
placeholder=
"Slack incoming webhook url"
></input>
</div>
</div>
<div
class=
"gf-form max-width-30"
>
<span
class=
"gf-form-label width-6"
>
Recipient
</span>
<input
type=
"text"
class=
"gf-form-input max-width-30"
ng-model=
"ctrl.model.settings.recipient"
data-placement=
"right"
>
</input>
<info-popover
mode=
"right-absolute"
>
Override default channel or user, use #channel-name or
<
@username
><
/@username
>
</info-popover>
</div>
</div>
</div>
<div
class=
"gf-form-group section"
ng-if=
"ctrl.model.type === 'email'"
>
<div
class=
"gf-form-group section"
ng-if=
"ctrl.model.type === 'email'"
>
...
...
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