Commit f8d1eb11 by utkarshcmu

Removed ExecError state

parent 4b53ea0a
......@@ -22,7 +22,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
return &PagerdutyNotifier{
NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings),
Key: key,
AlertOnExecError: model.Settings.Get("alertOnExecError").MustBool(),
log: log.New("alerting.notifier.pagerduty"),
}, nil
}
......@@ -30,7 +29,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
type PagerdutyNotifier struct {
NotifierBase
Key string
AlertOnExecError bool
log log.Logger
}
......@@ -38,8 +36,7 @@ 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) ||
((this.AlertOnExecError) && (evalContext.Rule.State == m.AlertStateExecError)) {
if evalContext.Rule.State == m.AlertStateAlerting {
// Pagerduty Events API URL
pgEventsUrl := "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
......
......@@ -26,11 +26,10 @@ func TestPagerdutyNotifier(t *testing.T) {
So(err, ShouldNotBeNil)
})
Convey("settings with alertOnExecError should trigger incident", func() {
Convey("settings should trigger incident", func() {
json := `
{
"integrationKey": "abcdefgh0123456789",
"alertOnExecError": true
"integrationKey": "abcdefgh0123456789"
}`
settingsJSON, _ := simplejson.NewJson([]byte(json))
......@@ -47,7 +46,6 @@ func TestPagerdutyNotifier(t *testing.T) {
So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing")
So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty")
So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789")
So(pagerdutyNotifier.AlertOnExecError, ShouldEqual, true)
})
})
......
......@@ -103,15 +103,6 @@
<span class="gf-form-label width-12">Integration Key</span>
<input type="text" required class="gf-form-input max-width-30" ng-model="ctrl.model.settings.integrationKey" placeholder="Pagerduty integeration Key"></input>
</div>
<div class="gf-form">
<gf-form-switch
class="gf-form"
label="Alert on Exec Error"
label-class="width-12"
checked="ctrl.model.settings.alertOnExecError"
tooltip="Trigger incident on Exec Error">
</gf-form-switch>
</div>
</div>
<div class="gf-form-group">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment