mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Removed ExecError state
This commit is contained in:
parent
4b53ea0a56
commit
f8d1eb11a9
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user