mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(pagerduty): declare url as constant
This commit is contained in:
parent
6dd076efc1
commit
7bc80d0374
@ -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,10 +41,6 @@ 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)
|
||||
@ -66,7 +66,7 @@ func (this *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
body, _ := bodyJSON.MarshalJSON()
|
||||
|
||||
cmd := &m.SendWebhook{
|
||||
Url: pgEventsUrl,
|
||||
Url: pagerdutyEventApiUrl,
|
||||
Body: string(body),
|
||||
HttpMethod: "POST",
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user