Commit f8d1eb11 by utkarshcmu

Removed ExecError state

parent 4b53ea0a
...@@ -22,7 +22,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error) ...@@ -22,7 +22,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
return &PagerdutyNotifier{ return &PagerdutyNotifier{
NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings), NotifierBase: NewNotifierBase(model.Id, model.IsDefault, model.Name, model.Type, model.Settings),
Key: key, Key: key,
AlertOnExecError: model.Settings.Get("alertOnExecError").MustBool(),
log: log.New("alerting.notifier.pagerduty"), log: log.New("alerting.notifier.pagerduty"),
}, nil }, nil
} }
...@@ -30,7 +29,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error) ...@@ -30,7 +29,6 @@ func NewPagerdutyNotifier(model *m.AlertNotification) (alerting.Notifier, error)
type PagerdutyNotifier struct { type PagerdutyNotifier struct {
NotifierBase NotifierBase
Key string Key string
AlertOnExecError bool
log log.Logger log log.Logger
} }
...@@ -38,8 +36,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error { ...@@ -38,8 +36,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
this.log.Info("Notifying Pagerduty") this.log.Info("Notifying Pagerduty")
metrics.M_Alerting_Notification_Sent_PagerDuty.Inc(1) metrics.M_Alerting_Notification_Sent_PagerDuty.Inc(1)
if (evalContext.Rule.State == m.AlertStateAlerting) || if evalContext.Rule.State == m.AlertStateAlerting {
((this.AlertOnExecError) && (evalContext.Rule.State == m.AlertStateExecError)) {
// Pagerduty Events API URL // Pagerduty Events API URL
pgEventsUrl := "https://events.pagerduty.com/generic/2010-04-15/create_event.json" pgEventsUrl := "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
......
...@@ -26,11 +26,10 @@ func TestPagerdutyNotifier(t *testing.T) { ...@@ -26,11 +26,10 @@ func TestPagerdutyNotifier(t *testing.T) {
So(err, ShouldNotBeNil) So(err, ShouldNotBeNil)
}) })
Convey("settings with alertOnExecError should trigger incident", func() { Convey("settings should trigger incident", func() {
json := ` json := `
{ {
"integrationKey": "abcdefgh0123456789", "integrationKey": "abcdefgh0123456789"
"alertOnExecError": true
}` }`
settingsJSON, _ := simplejson.NewJson([]byte(json)) settingsJSON, _ := simplejson.NewJson([]byte(json))
...@@ -47,7 +46,6 @@ func TestPagerdutyNotifier(t *testing.T) { ...@@ -47,7 +46,6 @@ func TestPagerdutyNotifier(t *testing.T) {
So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing") So(pagerdutyNotifier.Name, ShouldEqual, "pagerduty_testing")
So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty") So(pagerdutyNotifier.Type, ShouldEqual, "pagerduty")
So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789") So(pagerdutyNotifier.Key, ShouldEqual, "abcdefgh0123456789")
So(pagerdutyNotifier.AlertOnExecError, ShouldEqual, true)
}) })
}) })
......
...@@ -103,15 +103,6 @@ ...@@ -103,15 +103,6 @@
<span class="gf-form-label width-12">Integration Key</span> <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> <input type="text" required class="gf-form-input max-width-30" ng-model="ctrl.model.settings.integrationKey" placeholder="Pagerduty integeration Key"></input>
</div> </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>
<div class="gf-form-group"> <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