Add templating to PD-CEF fields; Add missing field (#1231)

* Allow templating of Component and Group in PagerDuty v2

Related to #1211

* Add missing PD-CEF field Component
This commit is contained in:
Mike Bryant 2018-02-09 09:50:18 +00:00 committed by stuart nelson
parent 5101d65938
commit 6615ed15d2
2 changed files with 5 additions and 2 deletions

View File

@ -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"`

View File

@ -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"`
@ -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),
}
}