Skip to content

Commit

Permalink
Add templating to PD-CEF fields; Add missing field (#1231)
Browse files Browse the repository at this point in the history
* Allow templating of Component and Group in PagerDuty v2

Related to #1211

* Add missing PD-CEF field Component
  • Loading branch information
mikebryant authored and stuartnelson3 committed Feb 9, 2018
1 parent 5101d65 commit 6615ed1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ type PagerdutyConfig struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Details map[string]string `yaml:"details,omitempty" json:"details,omitempty"`
Severity string `yaml:"severity,omitempty" json:"severity,omitempty"`
Class string `yaml:"class,omitempty" json:"class,omitempty"`
Component string `yaml:"component,omitempty" json:"component,omitempty"`
Group string `yaml:"group,omitempty" json:"group,omitempty"`

Expand Down
6 changes: 4 additions & 2 deletions notify/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ type pagerDutyPayload struct {
Source string `json:"source"`
Severity string `json:"severity"`
Timestamp string `json:"timestamp,omitempty"`
Class string `json:"class,omitempty"`
Component string `json:"component,omitempty"`
Group string `json:"group,omitempty"`
CustomDetails map[string]string `json:"custom_details,omitempty"`
Expand Down Expand Up @@ -508,8 +509,9 @@ func (n *PagerDuty) notifyV2(ctx context.Context, eventType, key string, tmpl fu
Source: tmpl(n.conf.Client),
Severity: tmpl(n.conf.Severity),
CustomDetails: details,
Component: n.conf.Component,
Group: n.conf.Group,
Class: tmpl(n.conf.Class),
Component: tmpl(n.conf.Component),
Group: tmpl(n.conf.Group),
}
}

Expand Down

0 comments on commit 6615ed1

Please sign in to comment.