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
8a7f87b7
Commit
8a7f87b7
authored
Sep 29, 2017
by
Carl Bergquist
Committed by
GitHub
Sep 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9311 from ctrlok/ctrlok/pagerdutyinfo
Include triggering metrics to pagerduty alerts (pretty print)
parents
46cc1464
d3558623
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
pkg/services/alerting/notifiers/pagerduty.go
+7
-0
No files found.
pkg/services/alerting/notifiers/pagerduty.go
View file @
8a7f87b7
...
...
@@ -3,6 +3,8 @@ package notifiers
import
(
"strconv"
"fmt"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/log"
...
...
@@ -72,6 +74,10 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
if
evalContext
.
Rule
.
State
==
m
.
AlertStateOK
{
eventType
=
"resolve"
}
customData
:=
"Triggered metrics:
\n\n
"
for
_
,
evt
:=
range
evalContext
.
EvalMatches
{
customData
=
customData
+
fmt
.
Sprintf
(
"%s: %v
\n
"
,
evt
.
Metric
,
evt
.
Value
)
}
this
.
log
.
Info
(
"Notifying Pagerduty"
,
"event_type"
,
eventType
)
...
...
@@ -79,6 +85,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
bodyJSON
.
Set
(
"service_key"
,
this
.
Key
)
bodyJSON
.
Set
(
"description"
,
evalContext
.
Rule
.
Name
+
" - "
+
evalContext
.
Rule
.
Message
)
bodyJSON
.
Set
(
"client"
,
"Grafana"
)
bodyJSON
.
Set
(
"details"
,
customData
)
bodyJSON
.
Set
(
"event_type"
,
eventType
)
bodyJSON
.
Set
(
"incident_key"
,
"alertId-"
+
strconv
.
FormatInt
(
evalContext
.
Rule
.
Id
,
10
))
...
...
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