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
df8cd764
Commit
df8cd764
authored
Oct 31, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added trigger options with Pagerduty
parent
139bbecc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
pkg/services/alerting/notifiers/pagerduty.go
+26
-6
public/app/features/alerting/partials/notification_edit.html
+0
-9
No files found.
pkg/services/alerting/notifiers/pagerduty.go
View file @
df8cd764
...
...
@@ -19,24 +19,44 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
return
nil
,
alerting
.
ValidationError
{
Reason
:
"Could not find integration key property in settings"
}
}
alertingStates
:=
make
([]
m
.
AlertStateType
,
0
)
alertingStates
=
append
(
alertingStates
,
m
.
AlertStateAlerting
)
if
model
.
Settings
.
Get
(
"alertOnExecError"
)
.
MustBool
()
{
alertingStates
=
append
(
alertingStates
,
m
.
AlertStateExecError
)
}
if
model
.
Settings
.
Get
(
"alertOnNoData"
)
.
MustBool
()
{
alertingStates
=
append
(
alertingStates
,
m
.
AlertStateNoData
)
}
return
&
PagerdutyNotifier
{
NotifierBase
:
NewNotifierBase
(
model
.
Id
,
model
.
IsDefault
,
model
.
Name
,
model
.
Type
,
model
.
Settings
),
Key
:
key
,
log
:
log
.
New
(
"alerting.notifier.pagerduty"
),
NotifierBase
:
NewNotifierBase
(
model
.
Id
,
model
.
IsDefault
,
model
.
Name
,
model
.
Type
,
model
.
Settings
),
Key
:
key
,
AlertingStates
:
alertingStates
,
log
:
log
.
New
(
"alerting.notifier.pagerduty"
),
},
nil
}
type
PagerdutyNotifier
struct
{
NotifierBase
Key
string
log
log
.
Logger
Key
string
AlertingStates
[]
m
.
AlertStateType
log
log
.
Logger
}
func
(
this
*
PagerdutyNotifier
)
Notify
(
evalContext
*
alerting
.
EvalContext
)
error
{
this
.
log
.
Info
(
"Notifying Pagerduty"
)
metrics
.
M_Alerting_Notification_Sent_PagerDuty
.
Inc
(
1
)
if
evalContext
.
Rule
.
State
==
m
.
AlertStateAlerting
{
shouldNotify
:=
false
for
_
,
state
:=
range
this
.
AlertingStates
{
if
evalContext
.
Rule
.
State
==
state
{
shouldNotify
=
true
break
}
}
if
shouldNotify
{
// Pagerduty Events API URL
pgEventsUrl
:=
"https://events.pagerduty.com/generic/2010-04-15/create_event.json"
...
...
public/app/features/alerting/partials/notification_edit.html
View file @
df8cd764
...
...
@@ -121,15 +121,6 @@
tooltip=
"Trigger incident on Execution Error"
>
</gf-form-switch>
</div>
<div
class=
"gf-form"
>
<gf-form-switch
class=
"gf-form"
label=
"Auto resolve on OK"
label-class=
"width-12"
checked=
"ctrl.model.settings.resolveOnOK"
tooltip=
"Resolve incident on OK"
>
</gf-form-switch>
</div>
</div>
<div
class=
"gf-form-group"
>
...
...
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