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
7bc80d03
Commit
7bc80d03
authored
Nov 08, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(pagerduty): declare url as constant
parent
6dd076ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
pkg/services/alerting/notifiers/pagerduty.go
+6
-6
No files found.
pkg/services/alerting/notifiers/pagerduty.go
View file @
7bc80d03
...
...
@@ -13,6 +13,10 @@ func init() {
alerting
.
RegisterNotifier
(
"pagerduty"
,
NewPagerdutyNotifier
)
}
var
(
pagerdutyEventApiUrl
string
=
"https://events.pagerduty.com/generic/2010-04-15/create_event.json"
)
func
NewPagerdutyNotifier
(
model
*
m
.
AlertNotification
)
(
alerting
.
Notifier
,
error
)
{
key
:=
model
.
Settings
.
Get
(
"integrationKey"
)
.
MustString
()
if
key
==
""
{
...
...
@@ -37,13 +41,9 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
metrics
.
M_Alerting_Notification_Sent_PagerDuty
.
Inc
(
1
)
if
evalContext
.
Rule
.
State
==
m
.
AlertStateAlerting
{
// Pagerduty Events API URL
pgEventsUrl
:=
"https://events.pagerduty.com/generic/2010-04-15/create_event.json"
bodyJSON
:=
simplejson
.
New
()
bodyJSON
.
Set
(
"service_key"
,
this
.
Key
)
bodyJSON
.
Set
(
"description"
,
evalContext
.
Rule
.
Name
+
" - "
+
evalContext
.
Rule
.
Message
)
bodyJSON
.
Set
(
"description"
,
evalContext
.
Rule
.
Name
+
" - "
+
evalContext
.
Rule
.
Message
)
bodyJSON
.
Set
(
"client"
,
"Grafana"
)
bodyJSON
.
Set
(
"event_type"
,
"trigger"
)
...
...
@@ -66,7 +66,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
body
,
_
:=
bodyJSON
.
MarshalJSON
()
cmd
:=
&
m
.
SendWebhook
{
Url
:
p
gEvents
Url
,
Url
:
p
agerdutyEventApi
Url
,
Body
:
string
(
body
),
HttpMethod
:
"POST"
,
}
...
...
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