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
2f60929d
Commit
2f60929d
authored
Nov 04, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added slack mention functionality
parent
6fa89456
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
pkg/services/alerting/notifiers/slack.go
+5
-2
public/app/features/alerting/partials/notification_edit.html
+11
-0
No files found.
pkg/services/alerting/notifiers/slack.go
View file @
2f60929d
...
...
@@ -23,11 +23,13 @@ func NewSlackNotifier(model *m.AlertNotification) (alerting.Notifier, error) {
}
recipient
:=
model
.
Settings
.
Get
(
"recipient"
)
.
MustString
()
mention
:=
model
.
Settings
.
Get
(
"mention"
)
.
MustString
()
return
&
SlackNotifier
{
NotifierBase
:
NewNotifierBase
(
model
.
Id
,
model
.
IsDefault
,
model
.
Name
,
model
.
Type
,
model
.
Settings
),
Url
:
url
,
Recipient
:
recipient
,
Mention
:
mention
,
log
:
log
.
New
(
"alerting.notifier.slack"
),
},
nil
}
...
...
@@ -36,6 +38,7 @@ type SlackNotifier struct {
NotifierBase
Url
string
Recipient
string
Mention
string
log
log
.
Logger
}
...
...
@@ -70,9 +73,9 @@ func (this *SlackNotifier) Notify(evalContext *alerting.EvalContext) error {
})
}
message
:=
""
message
:=
this
.
Mention
if
evalContext
.
Rule
.
State
!=
m
.
AlertStateOK
{
//dont add message when going back to alert state ok.
message
=
evalContext
.
Rule
.
Message
message
+=
" "
+
evalContext
.
Rule
.
Message
}
body
:=
map
[
string
]
interface
{}{
...
...
public/app/features/alerting/partials/notification_edit.html
View file @
2f60929d
...
...
@@ -74,6 +74,17 @@
Override default channel or user, use #channel-name or @username
</info-popover>
</div>
<div
class=
"gf-form max-width-30"
>
<span
class=
"gf-form-label width-6"
>
Mention
</span>
<input
type=
"text"
class=
"gf-form-input max-width-30"
ng-model=
"ctrl.model.settings.mention"
data-placement=
"right"
>
</input>
<info-popover
mode=
"right-absolute"
>
Mention a user or a group using @ when notifying in a channel
</info-popover>
</div>
</div>
<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