Skip to content

Commit 6615ed1

Browse files
mikebryantstuartnelson3
authored andcommitted
Add templating to PD-CEF fields; Add missing field (prometheus#1231)
* Allow templating of Component and Group in PagerDuty v2 Related to prometheus#1211 * Add missing PD-CEF field Component
1 parent 5101d65 commit 6615ed1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

config/notifiers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ type PagerdutyConfig struct {
203203
Description string `yaml:"description,omitempty" json:"description,omitempty"`
204204
Details map[string]string `yaml:"details,omitempty" json:"details,omitempty"`
205205
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
206+
Class string `yaml:"class,omitempty" json:"class,omitempty"`
206207
Component string `yaml:"component,omitempty" json:"component,omitempty"`
207208
Group string `yaml:"group,omitempty" json:"group,omitempty"`
208209

notify/impl.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ type pagerDutyPayload struct {
460460
Source string `json:"source"`
461461
Severity string `json:"severity"`
462462
Timestamp string `json:"timestamp,omitempty"`
463+
Class string `json:"class,omitempty"`
463464
Component string `json:"component,omitempty"`
464465
Group string `json:"group,omitempty"`
465466
CustomDetails map[string]string `json:"custom_details,omitempty"`
@@ -508,8 +509,9 @@ func (n *PagerDuty) notifyV2(ctx context.Context, eventType, key string, tmpl fu
508509
Source: tmpl(n.conf.Client),
509510
Severity: tmpl(n.conf.Severity),
510511
CustomDetails: details,
511-
Component: n.conf.Component,
512-
Group: n.conf.Group,
512+
Class: tmpl(n.conf.Class),
513+
Component: tmpl(n.conf.Component),
514+
Group: tmpl(n.conf.Group),
513515
}
514516
}
515517

0 commit comments

Comments
 (0)